Hydration API for offline-first? #1073
Unanswered
oshimayoan
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Howdy!
I wonder if the new hydration API can be used to implement offline-first on RN? If yes, I think there is a problem on this line:
https://github.com/tannerlinsley/react-query/blob/e200c99496b7ebea84da5a0df38242d80554a844/src/hydration/hydration.ts#L85
It appears that line will never let the
dehydratedState
to overwrite thequeryCache
. The reason is that when auseQuery
is executed with the same exact queryKey as the dehydrated, it will automatically create a new query onqueryCache
with newerupdatedAt
so that line above will always returntrue
.Also, the reason why
useQuery
is executed first beforeuseHydrate
is that I have to get the persisted state from AsyncStorage first.Beta Was this translation helpful? Give feedback.
All reactions