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
I am trying to implement a simple profile page that allow users to update their name and email.
The problem I encounter is when I update the name or email, the data in database is updated but the token and session object still contain the old name or email.
After putting some breakpoints in jwt and session callbacks, I found that every time I click the "Save Changes" button, six calls are made to the jwt callback but only one call contains the "update" trigger and new information.
I assume other five calls come from either the auth() call at the root layout.tsx or the useSession call. The order of the jwt calls is indeterministic, if the call with the "update" trigger is the last call, the token and session are updated correctly; otherwise, old session is return.
I spent tons of time for fixing the issue but fail to find a way. Examples or guides to correctly implement the feature are appreciated!
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Please refer to the actual code here: https://github.com/CurlyTeddy/Ours/blob/feature/add-profile-page/app/(home)/profile/page.tsx
I am trying to implement a simple profile page that allow users to update their name and email.
The problem I encounter is when I update the name or email, the data in database is updated but the token and session object still contain the old name or email.
After putting some breakpoints in jwt and session callbacks, I found that every time I click the "Save Changes" button, six calls are made to the jwt callback but only one call contains the "update" trigger and new information.
I assume other five calls come from either the auth() call at the root layout.tsx or the useSession call. The order of the jwt calls is indeterministic, if the call with the "update" trigger is the last call, the token and session are updated correctly; otherwise, old session is return.
I spent tons of time for fixing the issue but fail to find a way. Examples or guides to correctly implement the feature are appreciated!
Beta Was this translation helpful? Give feedback.
All reactions