Skip to content

Commit

Permalink
fix(query-async-storage-persister): support wider range of types (#4639)
Browse files Browse the repository at this point in the history
* fix(query-async-storage-persister): support wider range of types

interfaces like localforage return a Promise<T> from setItem; we don't really care, as long as it's a Promise

* chore: stabilize test

set a staleTime so that we don't get an additional fetch after the component re-mounts
  • Loading branch information
TkDodo committed Dec 14, 2022
1 parent 443b5a8 commit ce1259c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/query-async-storage-persister/src/index.ts
Expand Up @@ -7,7 +7,7 @@ import { asyncThrottle } from './asyncThrottle'

interface AsyncStorage {
getItem: (key: string) => Promise<string | null>
setItem: (key: string, value: string) => Promise<void>
setItem: (key: string, value: string) => Promise<unknown>
removeItem: (key: string) => Promise<void>
}

Expand Down
1 change: 1 addition & 0 deletions packages/react-query/src/__tests__/suspense.test.tsx
Expand Up @@ -1096,6 +1096,7 @@ describe('useQueries with suspense', () => {
await sleep(20)
return '2'
},
staleTime: 1000,
suspense: false,
},
],
Expand Down

0 comments on commit ce1259c

Please sign in to comment.