Replies: 1 comment
-
Hi, I think the current handling of sessionId (useSessionId) and query result (useRatesQuery) makes sense to me. I can't find a reason to use redux to store this global session again. I'm guessing that if you want to store dynamic sessions instead of just a fixed one with the redux store? This means that you can't get the sessionId by |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
I've recently picked up RQ for a work project. I'm following the "leveraging query fn context" and query key factory.
For the app, it has few steps:
session
, example endpoint "/api/session"session
on the server, example enpoint/api/session/{sessionId}/something
Basically in all queries/mutations except initial create one I need to access the
sessionId
value to pass it to the fetcher.What is the best way of sharing the
sessionId
value between all other queries / mutations?Currently my key factory looks like this:
Also I am saving the
sessionId
value in theall
key when initial session create resolves succesfuly.Then I do custom query fn like this
The project also has Redux so I tried storing the session in Redux but that doesn't feel right as I am storing server state in local state and that might change so then I have to worry to keep it in sync and also it creates issues when persisting in sessionStorate.
I hope I explained it clear enough but please let me know if not and maybe a small codesandbox with my simplified setup can be more helpful.
Any advice would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions