Replies: 1 comment
-
See #3941 |
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.
-
Question 💬
Hi, i am new to both next JS and react query and i have been cracking my head wondering how to reload session when using nextJS to populate session data with new data from backend for almost a week now.
Sceneario: User updates profile
current behaviour: User has to logout and login to get the new data persisted to the session
Expected Results: Session query key gets updated with new session and with the data the user inputed previously
Tools used: Next.js, Next-auth, react-query
Code:
This is the code we are currently running in our application
_app.js
useQuerySession.js
This is where we make a call to the api to get the session and store it as a query
We have previously gone through the issues to see if there's a way to do this and we came across this reload session function
session.js
we have tried using this function and the session does not get updated with the new data. we think it is because we chose to use react-query and not include the session provider component in our _app.js
So the $64000 question is. how can i get to reload my session so if a user updates a profile my session updates too without having to prompt the user to logout and login again using react-query. is there any function we could call or anything we could use.
Thank you.
How to reproduce ☕️
attempt to use react-query with next js
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Beta Was this translation helpful? Give feedback.
All reactions