Next.js Discord

Discord Forum

When reload, components change

Unanswered
Snowy Egret posted this in #help-forum
Open in Discord
Avatar
Snowy EgretOP
Hello, is there any way to achieve components not changing when user is still logged in? I have component user profile on my website, when i click F5 (reload the page) the component dissapears and quickly gets back, can i avoid this?

7 Replies

Avatar
well, you must be showing user data in your profile component right? like profile picture and user name
and those data must be from the db and you need some time to fetch them. why don't you have a suspense around your component and show fallback UI
Avatar
Snowy EgretOP
I understand you, my data are fetched from the PHP beckend, don’t ask why 😆, bud that really doesn’t care, i just want to avoid data disappearing when page reloads while they appears back the same way as they were before. I’ve seen this on many sites already but didn’t manage to achieve this
Avatar
are you using Next.js anyway right?
Avatar
Snowy EgretOP
y
Avatar
as long as you are using Next.js you can still manage it
it's okay to use PHP backend or whatever - just have fallback Ui