Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit 9ca65b8

Browse files
authored
fix: support useQueryCache (#36)
* Use useQueryCache Uses useQueryCache instead of the default cache to enable the dev tools if useQuery is used throughout the code base. * useQueryCache fallback for version < 1.5 * Fix name clash
1 parent 96b9f23 commit 9ca65b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import match from 'match-sorter'
3-
import { queryCache } from 'react-query'
3+
import { queryCache as cache, useQueryCache } from 'react-query'
44
import useLocalStorage from './useLocalStorage'
55

66
//
@@ -164,6 +164,9 @@ const sortFns = {
164164

165165
export const ReactQueryDevtoolsPanel = React.forwardRef(
166166
function ReactQueryDevtoolsPanel(props, ref) {
167+
168+
const queryCache = useQueryCache ? useQueryCache() : cache;
169+
167170
const [sort, setSort] = useLocalStorage(
168171
'reactQueryDevtoolsSortFn',
169172
Object.keys(sortFns)[0]

0 commit comments

Comments
 (0)