Updating query data based on previous data #1828
Unanswered
PabloRomanH
asked this question in
Q&A
Replies: 3 comments 3 replies
-
You should be able to get the old query data inside the queryFn and just append your data before returning the promise with getQueryData. If you have a codesandbox with the issue I can take a look |
Beta Was this translation helpful? Give feedback.
3 replies
-
I'll try doing that!
El vie, 19 feb 2021 a las 14:26, Dominik Dorfmeister (<
[email protected]>) escribió:
… You can disable the query until hydration is finished
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1828 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJMIZYQUV6ZYJJLIQI3VNDS7YHA3ANCNFSM4X3TQALA>
.
--
Pablo Roman
Learn Spanish naturally: youtube.com/DreamingSpanish
Blog about SLA: dreaminglanguages.com
<http://dreaminglanguages.wordpress.com/>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
v5 pseudo code for reference
|
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I have an endpoint that can return a lot of data, so I have a parameter to ask it to only return new data after a certain date.
Then I'm persisting this data to IndexedDB, so every time I load the page, my query has access to the old cached data. The problem is that when loading the page, the old data only lasts until the most recent data is fetched from the backend.
How can I update the data in the query based on the new received data without losing the old data? I've tried using queryClient.getQueryData() inside the useQuery function (queryFn), but I just get undefined. I also don't see the old data being passed to queryFn.
Beta Was this translation helpful? Give feedback.
All reactions