@tanstack/react-query-devtools 5.0.0-alpha.47 → 5.0.0-alpha.49
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/build/lib/index.prod.js +16 -52
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +16 -52
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/umd/index.development.js +16 -52
- package/build/umd/index.development.js.map +1 -1
- package/package.json +2 -2
- package/build/lib/devtools.esm.js +0 -59
- package/build/lib/devtools.esm.js.map +0 -1
- package/build/lib/index.esm.js +0 -16
- package/build/lib/index.esm.js.map +0 -1
- package/build/lib/index.prod.esm.js +0 -8021
- package/build/lib/index.prod.esm.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query-devtools",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.49",
|
|
4
4
|
"description": "Developer tools to interact with and visualize the TanStack/react-query cache",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"type": "commonjs",
|
|
14
14
|
"types": "build/lib/index.d.ts",
|
|
15
15
|
"main": "build/lib/index.js",
|
|
16
|
-
"module": "build/lib/index.
|
|
16
|
+
"module": "build/lib/index.mjs",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./build/lib/index.d.ts",
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React, { useRef, useState, useEffect } from 'react';
|
|
3
|
-
import { useQueryClient, onlineManager } from '@tanstack/react-query';
|
|
4
|
-
import { TanstackQueryDevtools } from '@tanstack/query-devtools';
|
|
5
|
-
|
|
6
|
-
function ReactQueryDevtools(props) {
|
|
7
|
-
const queryClient = useQueryClient();
|
|
8
|
-
const client = props.client || queryClient;
|
|
9
|
-
const ref = useRef(null);
|
|
10
|
-
const {
|
|
11
|
-
buttonPosition,
|
|
12
|
-
position,
|
|
13
|
-
initialIsOpen,
|
|
14
|
-
errorTypes
|
|
15
|
-
} = props;
|
|
16
|
-
const [devtools] = useState(new TanstackQueryDevtools({
|
|
17
|
-
client: client,
|
|
18
|
-
queryFlavor: 'React Query',
|
|
19
|
-
version: '5',
|
|
20
|
-
onlineManager,
|
|
21
|
-
buttonPosition,
|
|
22
|
-
position,
|
|
23
|
-
initialIsOpen,
|
|
24
|
-
errorTypes
|
|
25
|
-
}));
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
devtools.setClient(client);
|
|
28
|
-
}, [client, devtools]);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (buttonPosition) {
|
|
31
|
-
devtools.setButtonPosition(buttonPosition);
|
|
32
|
-
}
|
|
33
|
-
}, [buttonPosition, devtools]);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (position) {
|
|
36
|
-
devtools.setPosition(position);
|
|
37
|
-
}
|
|
38
|
-
}, [position, devtools]);
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
devtools.setInitialIsOpen(initialIsOpen || false);
|
|
41
|
-
}, [initialIsOpen, devtools]);
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
devtools.setErrorTypes(errorTypes || []);
|
|
44
|
-
}, [errorTypes, devtools]);
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (ref.current) {
|
|
47
|
-
devtools.mount(ref.current);
|
|
48
|
-
}
|
|
49
|
-
return () => {
|
|
50
|
-
devtools.unmount();
|
|
51
|
-
};
|
|
52
|
-
}, [devtools]);
|
|
53
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
ref: ref
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { ReactQueryDevtools };
|
|
59
|
-
//# sourceMappingURL=devtools.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.esm.js","sources":["../../src/devtools.tsx"],"sourcesContent":["'use client'\nimport { useRef, useState, useEffect } from 'react'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useQueryClient, onlineManager } from '@tanstack/react-query'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsPosition,\n DevToolsErrorType,\n} from '@tanstack/query-devtools'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport React from 'react'\n\nexport interface DevtoolsOptions {\n /**\n * Set this true if you want the dev tools to default to being open\n */\n initialIsOpen?: boolean\n /**\n * The position of the React Query logo to open and close the devtools panel.\n * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n * Defaults to 'bottom-left'.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the React Query devtools panel.\n * 'top' | 'bottom' | 'left' | 'right'\n * Defaults to 'bottom'.\n */\n position?: DevtoolsPosition\n /**\n * Custom instance of QueryClient\n */\n client?: QueryClient\n /**\n * Use this so you can define custom errors that can be shown in the devtools.\n */\n errorTypes?: DevToolsErrorType[]\n}\n\nexport function ReactQueryDevtools(\n props: DevtoolsOptions,\n): React.ReactElement | null {\n const queryClient = useQueryClient()\n const client = props.client || queryClient\n const ref = useRef<HTMLDivElement>(null)\n const { buttonPosition, position, initialIsOpen, errorTypes } = props\n const [devtools] = useState(\n new TanstackQueryDevtools({\n client: client,\n queryFlavor: 'React Query',\n version: '5',\n onlineManager,\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n }),\n )\n\n useEffect(() => {\n devtools.setClient(client)\n }, [client, devtools])\n\n useEffect(() => {\n if (buttonPosition) {\n devtools.setButtonPosition(buttonPosition)\n }\n }, [buttonPosition, devtools])\n\n useEffect(() => {\n if (position) {\n devtools.setPosition(position)\n }\n }, [position, devtools])\n\n useEffect(() => {\n devtools.setInitialIsOpen(initialIsOpen || false)\n }, [initialIsOpen, devtools])\n\n useEffect(() => {\n devtools.setErrorTypes(errorTypes || [])\n }, [errorTypes, devtools])\n\n useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return <div ref={ref}></div>\n}\n"],"names":["errorTypes","client","queryFlavor","version","useEffect","devtools","ref"],"mappings":";;;;;AAuCO;AAGL;AACA;AACA;;;;;AACiDA;AAAW;;AAGxDC;AACAC;AACAC;;;;;AAKAH;AACF;AAGFI;AACEC;AACF;AAEAD;AACE;AACEC;AACF;AACF;AAEAD;AACE;AACEC;AACF;AACF;AAEAD;AACEC;AACF;AAEAD;AACEC;AACF;AAEAD;;AAEIC;AACF;AAEA;;;AAGF;;AAEYC;AAAS;AACvB;;"}
|
package/build/lib/index.esm.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { ReactQueryDevtools as ReactQueryDevtools$1 } from './devtools.esm.js';
|
|
3
|
-
|
|
4
|
-
const ReactQueryDevtools = process.env.NODE_ENV !== 'development' ? function () {
|
|
5
|
-
return null;
|
|
6
|
-
} : ReactQueryDevtools$1;
|
|
7
|
-
|
|
8
|
-
// export const ReactQueryDevtoolsPanel: (typeof devtools)['ReactQueryDevtoolsPanel'] =
|
|
9
|
-
// process.env.NODE_ENV !== 'development'
|
|
10
|
-
// ? (function () {
|
|
11
|
-
// return null
|
|
12
|
-
// } as any)
|
|
13
|
-
// : devtools.ReactQueryDevtoolsPanel
|
|
14
|
-
|
|
15
|
-
export { ReactQueryDevtools };
|
|
16
|
-
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../src/index.ts"],"sourcesContent":["'use client'\n\nimport * as devtools from './devtools'\n\nexport const ReactQueryDevtools: (typeof devtools)['ReactQueryDevtools'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtools.ReactQueryDevtools\n\n// export const ReactQueryDevtoolsPanel: (typeof devtools)['ReactQueryDevtoolsPanel'] =\n// process.env.NODE_ENV !== 'development'\n// ? (function () {\n// return null\n// } as any)\n// : devtools.ReactQueryDevtoolsPanel\n"],"names":[],"mappings":";;;AAIO;AAGC;AACF;;AAGN;AACA;AACA;AACA;AACA;AACA;;"}
|