Next.js Discord

Discord Forum

hydration not working after login

Answered
Multiflora rose seed chalcid posted this in #help-forum
Open in Discord
Multiflora rose seed chalcidOP
My nextjs (15.3) frontend does not update the menu after login.
The nextjs backend knows if the user is logged in and sends the menu to the client, but the frontend doesn't change, even tho the newly send content is correct.

router.refresh(); didn't help, maybe I am making a mistake.

Server log after Login
Server [NavWrapper] Links determined: Home, Dashboard

Frontend still renders only "Home".

after manual refresh of the page, the menu is correct.
Answered by Dutch
revalidatePath ?
View full answer

4 Replies

Multiflora rose seed chalcidOP
NavWrapper is a server component that directly renders Nav which is a client component.
@Multiflora rose seed chalcid Click to see attachment
Dutch
revalidatePath ?
Answer
@Dutch `revalidatePath` ?
Multiflora rose seed chalcidOP
Yeah I switched now from API Routes for this matter to server actions and revalidate the Paths there. That works now perfectly.
Thank you!