@buoy-gg/react-query 7.0.30 → 7.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/react-query/components/ReactQueryTracker.js +38 -0
- package/lib/commonjs/react-query/components/query-browser/Explorer.js +46 -975
- package/lib/module/index.js +6 -0
- package/lib/module/react-query/components/ReactQueryTracker.js +35 -0
- package/lib/module/react-query/components/query-browser/Explorer.js +50 -982
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/react-query/components/ReactQueryTracker.d.ts +20 -0
- package/lib/typescript/react-query/components/ReactQueryTracker.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/Explorer.d.ts +18 -3
- package/lib/typescript/react-query/components/query-browser/Explorer.d.ts.map +1 -1
- package/package.json +3 -3
package/lib/commonjs/index.js
CHANGED
|
@@ -50,6 +50,7 @@ var _exportNames = {
|
|
|
50
50
|
WifiToggle: true,
|
|
51
51
|
ReactQuerySection: true,
|
|
52
52
|
ReactQueryDevToolsModal: true,
|
|
53
|
+
ReactQueryTracker: true,
|
|
53
54
|
VirtualizedDataExplorer: true,
|
|
54
55
|
DataViewer: true,
|
|
55
56
|
TypeLegend: true,
|
|
@@ -288,6 +289,12 @@ Object.defineProperty(exports, "ReactQuerySection", {
|
|
|
288
289
|
return _ReactQuerySection.ReactQuerySection;
|
|
289
290
|
}
|
|
290
291
|
});
|
|
292
|
+
Object.defineProperty(exports, "ReactQueryTracker", {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
get: function () {
|
|
295
|
+
return _ReactQueryTracker.ReactQueryTracker;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
291
298
|
Object.defineProperty(exports, "StorageStatusCount", {
|
|
292
299
|
enumerable: true,
|
|
293
300
|
get: function () {
|
|
@@ -539,6 +546,7 @@ var _QueryDebugInfo = require("./react-query/components/QueryDebugInfo");
|
|
|
539
546
|
var _WifiToggle = require("./react-query/components/WifiToggle");
|
|
540
547
|
var _ReactQuerySection = require("./react-query/components/ReactQuerySection");
|
|
541
548
|
var _ReactQueryDevToolsModal = require("./react-query/components/ReactQueryDevToolsModal");
|
|
549
|
+
var _ReactQueryTracker = require("./react-query/components/ReactQueryTracker");
|
|
542
550
|
var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
|
|
543
551
|
var _useAllQueries = _interopRequireDefault(require("./react-query/hooks/useAllQueries"));
|
|
544
552
|
var _useAllMutations = _interopRequireDefault(require("./react-query/hooks/useAllMutations"));
|
|
@@ -685,6 +693,12 @@ try {
|
|
|
685
693
|
|
|
686
694
|
// Mode components
|
|
687
695
|
|
|
696
|
+
/**
|
|
697
|
+
* Connects the event store to the app's QueryClient at startup. Auto-rendered
|
|
698
|
+
* by `FloatingDevTools`; exported so a host that does not use the floating menu
|
|
699
|
+
* can mount it itself.
|
|
700
|
+
*/
|
|
701
|
+
|
|
688
702
|
// Shared data viewer components
|
|
689
703
|
|
|
690
704
|
// =============================================================================
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ReactQueryTracker = ReactQueryTracker;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
9
|
+
var _reactQueryEventStore = require("../stores/reactQueryEventStore");
|
|
10
|
+
/**
|
|
11
|
+
* Connects the React Query event store to the app's QueryClient at startup.
|
|
12
|
+
*
|
|
13
|
+
* Auto-rendered by `FloatingDevTools` (the same treatment `RouteTracker` gets),
|
|
14
|
+
* so nobody has to mount it by hand.
|
|
15
|
+
*
|
|
16
|
+
* Why it has to exist: until this, `setQueryClient` was called from exactly one
|
|
17
|
+
* place — `ReactQueryDevToolsModal`'s mount effect — which meant the store had
|
|
18
|
+
* no client unless somebody opened the React Query TOOL. Anything else that
|
|
19
|
+
* consumes these events was therefore silently empty, and the Events timeline
|
|
20
|
+
* showed a React Query badge with a confident `0` on it: not "nothing to
|
|
21
|
+
* report" but "nobody was listening", and no way to tell the two apart.
|
|
22
|
+
*
|
|
23
|
+
* `useContext(QueryClientContext)`, NOT `useQueryClient()`: the hook throws
|
|
24
|
+
* when there is no provider above it, and this component is mounted whether or
|
|
25
|
+
* not the host app uses React Query at all. An app without a provider just
|
|
26
|
+
* reads `undefined` here and nothing connects, which is the old behaviour.
|
|
27
|
+
*/
|
|
28
|
+
function ReactQueryTracker() {
|
|
29
|
+
const queryClient = (0, _react.useContext)(_reactQuery.QueryClientContext);
|
|
30
|
+
(0, _react.useEffect)(() => {
|
|
31
|
+
if (!queryClient) return;
|
|
32
|
+
// The tool connects the same client when it opens; leave that alone rather
|
|
33
|
+
// than tearing down its cache subscriptions and rebuilding them.
|
|
34
|
+
if (_reactQueryEventStore.reactQueryEventStore.isConnected()) return;
|
|
35
|
+
_reactQueryEventStore.reactQueryEventStore.setQueryClient(queryClient);
|
|
36
|
+
}, [queryClient]);
|
|
37
|
+
return null;
|
|
38
|
+
}
|