On page refresh, First view in the container flashes for few seconds. Can anyone answer this please?

I am working on the Admin Panel Project. There I have created an app with a single container which will have 5 views. So Everything is working correctly. But when I am refreshing the page, it is automatically going to the first view. So we wrote a javascript code as a query which will set the current view on page loading. It is working but the issue is, the first view is anyway coming for a flash of moment. How to prevent that. Kindly, Can you provide any ideas on that?

Hey Saranya!
Welcome to the community :-).
Can you please share the config of the configuration? How do you pick the view to display to the user?

Screenshots and/or code is in general super helpful when problem solving.

Jonathan

While navigating to a specific view, we store the CurrentView in local storage. so while page loading, when the user is signed in, it takes from the local storage to show the current view.

if(localStorage.values.User)
{
MainContainer.setCurrentViewIndex(localStorage.values.CurrentView);
}
else {
MainContainer.setCurrentViewIndex(0);
MainContainer.setCurrentView("SigninView")
}

Hey @saranya.cp_123!

For the container itself, does it have the first view set as a default?

Hey Victoria, Thank you for responding!!

No default is not set.
image

Could you try setting the default view to something like:

{{ localStorage.values.User ? localStorage.values.CurrentView : “SigninView” }}

instead of having the logic live elsewhere.

Does that result in the same flashing behavior?

Hi Victoria,

Yes I will try in this way.

Thanks Victoria.

Awesome! Let me know how it goes :smile:

Hi Victoria,
Sorry for the delay. The problem is still there Victoria. Is there any other way? Can you please help?

Would you mind sharing a screenshot of your current configuration? And if I could step into your app, that would be helpful as well! If this sounds alright with you, feel free to DM me a link to your app and I'd be happy to take a look.