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

Commit

Permalink
fix: support useQueryCache (#36)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Domino987 committed Jun 19, 2020
1 parent 96b9f23 commit 9ca65b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
@@ -1,6 +1,6 @@
import React from 'react'
import match from 'match-sorter'
import { queryCache } from 'react-query'
import { queryCache as cache, useQueryCache } from 'react-query'
import useLocalStorage from './useLocalStorage'

//
Expand Down Expand Up @@ -164,6 +164,9 @@ const sortFns = {

export const ReactQueryDevtoolsPanel = React.forwardRef(
function ReactQueryDevtoolsPanel(props, ref) {

const queryCache = useQueryCache ? useQueryCache() : cache;

const [sort, setSort] = useLocalStorage(
'reactQueryDevtoolsSortFn',
Object.keys(sortFns)[0]
Expand Down

0 comments on commit 9ca65b8

Please sign in to comment.