invertase / invertase/tanstack-query-firebase
1.0.0-dev7: useFirestoreDocumentData does not update invalidated data (react 18.2.0, react-query 3.39.2)
- Dominant language
- TypeScript
- Stars
- 462
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
After bumping `@react-query-firebase/firestore` (mostly to workaround React 18.2.0 peer dep), the query invalidation stops working.
I do not have time to create minimal repro sandbox. Posting as a heads-up to others.
Reverting to **0.4.2** fixes the issue.
Simplified pseudo-code:
```
// Disable auto-refetching to avoid noise.
const queryClient = new QueryClient({defaultOptions: {queries: {staleTime: Infinity, cacheTime: Infinity}}});
...
const ref = docRef.withConverter(converter);
// simplified, just to demonstrate invalidation method.
const onSuccess = async () => ({await queryClient.invalidateQueries({predicate: () => true})});
const {data} = useFirestoreDocumentData(path, ref), // not a subscription
{mutate} = useFirestoreDocumentMutation(docRef, {merge: true}, {onSuccess});
```
Actual results when calling `mutate({field: someVal})`
* The value is updated is Firebase
* `onSuccess` is called
* The query is invalidated as expected and refetched, according to network/logs/react-query-devtools
* According to debug logs, after refetching the converter applied on `ref` is called with proper "new" value
Until this point, works as expected. But the values are not updated in:
* query data in react-query-devtools,
* `useFirestoreDocumentData` hook data in React Dev Tools,
* the app.
Contributor guide
Assessment
This issue has not been assessed yet.