You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, i am new to both next JS and react query and i am wondering how to reload session when using nextJS to populate session data with new data from backend.
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, i am new to both next JS and react query and i am wondering how to reload session when using nextJS to populate session data with new data from backend.
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.
Beta Was this translation helpful? Give feedback.
All reactions