You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The useCurrentUser composable returns a nullable ref of the current user. However, it can also be undefined while the user is still loading. It is common practice to hide navigation to areas that a logged out user should not be able to access. If a user is logged in already and refreshes the page they will see a brief "flash of logged out nav" before the user finishes loading and the logged in nav appears.
What problem is this solving
The
useCurrentUser
composable returns a nullable ref of the current user. However, it can also beundefined
while the user is still loading. It is common practice to hide navigation to areas that a logged out user should not be able to access. If a user is logged in already and refreshes the page they will see a brief "flash of logged out nav" before the user finishes loading and the logged in nav appears.Proposed solution
It would be useful if an explicit
userLoaded
state were exposed from theuseCurrentUser
composable. Something that does the following.So that it could be used like this.
I've found that using
v-show
is best in this case since it doesn't cause the DOM to reflow likev-if
does on the top level nav.Describe alternatives you've considered
Currently I do the following instead.
I realize this isn't a lot of work to do, but having a formal implementation would mean it's easier to document the pattern.
Additional Considerations
This would change how the API works since
useCurrentUser
returns a user, not an object with a user in it.The text was updated successfully, but these errors were encountered: