Split second render of unwanted component when logged in
Unanswered
False honey ant posted this in #help-forum
False honey antOP
Hello, I would like to ask about something that I can't get to do, i am implementing authentication using next-auth, and i have this problem where in my navbar, i have a sign in button and go to dashboard and i show only the dashboard button if i am signed, I am using conditional rendering, the problem is when i am logged i and i refresh my page the signin button is shown for like a second and then the dashboard button comes again. How can i prevent this?
14 Replies
Chub mackerel
can share codes or just share link of repo
False honey antOP
Chub mackerel
did you create custom callback for session or jwt
?
False honey antOP
i am using next auth
i just imported the use session hook
Chub mackerel
session: {
strategy: "jwt",
}
if you use this on auth.ts, checkout the application on inspect. check is cookie setting or not
what version of next-auth are you using?
False honey antOP
i am using v4
its jwt
Chub mackerel
use v5, it more compatible with next, specially with app route
False honey antOP
okay, i will
do you know how could i fix this problem
in the provided code when i refresh, i get a split second flicker of the sign in buttons when i am logged in then i get the welcome back text