#Refreshing authentication status on navbar

1 messages · Page 1 of 1 (latest)

zealous shuttleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

bright vessel
#

" I use a server action that redirects the user to the dashboard when successful, but fails to update the session UI data"

did u try calling refresh()?

#

after everything is done in server action

#

did u use unstable_cache or "use cache"?

#

can you send which files are relevant to the issue?

regal dagger
#

I tried calling refresh(), yes

#

‘Use cache’

bright vessel
regal dagger
#

Just a minute

#

This is the login sserver action

bright vessel
#

whats inside authClient?

#

you need to do debugging

#

console.log at each part of the getCurrentUser to see what went wrong

#

why it returned null

regal dagger
#

It is an instance of a custom package of mine, which for sure works

#

to handle authentication with JWT

#

Because I console.log the output of the function, and returns the correct value in the console, but does not update the UI

bright vessel
#

this is weird. can you reproduce it in a minimal repository?

regal dagger
#

I will try to do it

regal dagger
#

So I just tried doing it, and looks like the problem is with cacheComponents

#

I obviously had to try it out when it became stable in this version

#

Based on what I saw, it was prerendering the navigation bar

#

as soon as i disable cache components, it works just fine

regal dagger
#

even though "SessionContainer" is supposed to be dynamic, react is prerendering it for some reason

#

This is after prepending my component code with await connection()

#

Looks like cacheComponents still has a lot of stuff to work on

bright vessel
#

Curious to see how that is possible

bright vessel
#

hard to imagine how you did it

regal dagger
regal dagger
# regal dagger

also I completely removed the cache() wrapper function from here. apparently that has caused problems too

bright vessel
#

thats weird. can you make a minimal reproduction repository?

#

its really hard to debug since you used custom packages and im not sure whats inside of those thats causing it to misbehave

regal dagger
#

Yes for sure

regal dagger