invertase / invertase/tanstack-query-firebase

useFirestoreDocument/useFirestoreQuery with { subscribe: true } are not subscribing to realtime updates on remount

Open
#25 72 comments 4 reactions 1 assignee Claimed by @Ehesp View on GitHub
bug react-query-firebase
Dominant language
TypeScript
Stars
462
Forks
69
PR merge metrics
No merged PRs in 30d

Description

I've discovered a weird behaviour of useFirestoreDocument/useFirestoreQuery hooks: `{ subscribe: true }` option will have no effect, if query is remounted (in default `cacheTime` 5 mins window), after became inactive. Probably, It will be good, if query will resubscribe to realtime changes, if there is a snapshot in a cache and there are no active subscribers.

As a workaround we are setting `cacheTime` to 0, so query will trigger queryFn again and put active subscription on firestore query.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.