@tanstack/react-query-devtools 5.0.0-alpha.27 → 5.0.0-alpha.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-query-devtools",
3
- "version": "5.0.0-alpha.27",
3
+ "version": "5.0.0-alpha.30",
4
4
  "description": "Developer tools to interact with and visualize the TanStack/react-query cache",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "@tanstack/react-query": "5.0.0-alpha.26"
47
47
  },
48
48
  "dependencies": {
49
- "@tanstack/query-devtools": "5.0.0-alpha.27"
49
+ "@tanstack/query-devtools": "5.0.0-alpha.30"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": "^18.0.0",
package/src/devtools.tsx CHANGED
@@ -40,11 +40,12 @@ export function ReactQueryDevtools(
40
40
  props: DevtoolsOptions,
41
41
  ): React.ReactElement | null {
42
42
  const queryClient = useQueryClient()
43
+ const client = props.client || queryClient
43
44
  const ref = useRef<HTMLDivElement>(null)
44
45
  const { buttonPosition, position, initialIsOpen, errorTypes } = props
45
46
  const [devtools] = useState(
46
47
  new TanstackQueryDevtools({
47
- client: props.client || queryClient,
48
+ client: client,
48
49
  queryFlavor: 'React Query',
49
50
  version: '5',
50
51
  onlineManager,
@@ -55,6 +56,10 @@ export function ReactQueryDevtools(
55
56
  }),
56
57
  )
57
58
 
59
+ useEffect(() => {
60
+ devtools.setClient(client)
61
+ }, [client, devtools])
62
+
58
63
  useEffect(() => {
59
64
  if (buttonPosition) {
60
65
  devtools.setButtonPosition(buttonPosition)