fix: resolve auth initialization race and username flicker on login
Always initialize auth before mounting the app so loading state completes and onAuthStateChange is registered on every route. Gate header auth UI on !loading to avoid flicker during email confirm and password reset flows. Load profile before setting user ref so displayUsername shows the correct name immediately instead of flashing the email.
This commit is contained in:
+2
-7
@@ -14,12 +14,7 @@ app.use(pinia)
|
||||
|
||||
const authStore = useAuthStore()
|
||||
|
||||
if (['/auth/confirm', '/auth/reset-password'].includes(window.location.pathname)) {
|
||||
authStore.initialize().then(() => {
|
||||
app.use(router)
|
||||
app.mount('#app')
|
||||
} else {
|
||||
authStore.initialize().then(() => {
|
||||
app.use(router)
|
||||
app.mount('#app')
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user