This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
How to reload a next auth session while using react-query #4275
Labels
question
Ask how to do something or how something works
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
The text was updated successfully, but these errors were encountered: