I can see unwanted pages


I am using async routes to control whether a user can see a page or not (depending on if they are logged in or not). But for some reason, I can see the unwanted page very fast. Example, if I go to the user’s homepage (via url) and I am not logged in, I can see the user homepage for maybe a millisecond or so, and then it changes to the correct page(login page).

Is there a fix to that?

I appreciate any help.

this solution solves this problem also.