N
Nuxt5mo ago
nandi95

hydration mismatch

I load the user in a global middleware if they are logged in:
export default defineNuxtRouteMiddleware(async () => {
const auth = useAuthStore();

if (auth.loggedIn && !auth.userLoaded) {
await auth.fetchUser();
}
});
export default defineNuxtRouteMiddleware(async () => {
const auth = useAuthStore();

if (auth.loggedIn && !auth.userLoaded) {
await auth.fetchUser();
}
});
user is logged in In server The user isn't loaded so it loads it, then user is there during hyrdration and on client side (from the payload) for some reason when the component is created it doesn't have this data (user id) available as seen on the video if I log the user data in the setup (created lifecycle hook) the user data isn't there what am I missing?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server