Tom
useState working in SSR but undefined in browser
Hey everyone,
I'm unsure how to tackle this, I have a composable:
In the front end if I
getUser
in the front end and console.log(user.value)
it's undefined, but if I return user.value
inside getUser()
everyone works as expected. I'm misunderstanding how state is used here. Can anyone explain where I'm going wrong?1 replies
@nuxt/scripts Save user selection?
Hello,
I've created a custom cookie consent banner using
@nuxt/scripts
, I am using https://scripts.nuxt.com/docs/api/use-consent-script-trigger. If a user refreshes the consent state is lost. Is there a way to keep their consent settings?1 replies
Preventing Refetching in Component
Hey everyone,
I'm using
useAsyncData
with a key so useAsyncData('config')
, what I thought the key did is if config
already exists in the payload it will load from there rather than refetching. That way you can safely use useAsyncData
inside components.
This is super useful as you can just drop in components and the data will come with it. If you can have multiple components pulling from the data source, rather than making multiple requests it will load from the payload.
I'm finding that I have a component that loads config data for the menu, each time the menu is unmounted and mounted it refetches data from the database endpoint.
Have I misunderstood what they key does in useAsyncData
and is there a way to make it behave like I described?6 replies
A/B Testing Middleware
Hello everyone,
I'm wanting to do some A/B Testing on Vercel. The guide is for NextJS (https://vercel.com/blog/ab-testing-with-nextjs-and-vercel#experimenting-at-the-edge).
So I'm looking to convert this into Nuxt, the only thing I can't seem to find any information on is how to set a cookie in a Nuxt Middleware. I've attempted to use
useCookie()
.6 replies