Replies: 1 comment 1 reply
-
you can use queryClient.getQueriesData, which supports fuzzy key matching, so:
to get all services, independent of their |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have an app with SSR server on which I dehydrate state after some prefetching, effectively hydrating it back on frontend.
In every request (so far) I have
logs
field I want to populate myLogsContext
with on mount (or before, doesn't matter much).So, to do that I need the
appendLog
function (there is also an option to populate initial value ofLogsContext
, but I prefer to keep dehydrated state only inindex.tsx
if it's possible), dehydrated state with all the logs and some kind of evaluator that can extract logs from that state. The latter is hard (or I'm doing something terribly wrong).My current setup is more or less like in this snippet.
Basically I have two problems.
First, I shouldn't compare my
queryKey
s by reference because they'll differ is they're not plain strings.Second, I don't have an option to get arguments for my
getKey
function to walk through all the keys I got. (marked as "???" in the snippet).I tried to put a one-time-shot
useEffect
in everyuseQuery
wrapper I have, but this approach have two issues: logs don't get to context all at once (say I prefetched a query I'll not mount for some time on client) and they can get there multiple times if I remount component with a query.Any ideas? :)
Beta Was this translation helpful? Give feedback.
All reactions