#UseCookie has a nesting limit?

3 messages · Page 1 of 1 (latest)

sick flint
#

Hello, I'm trying to persist the store (pinia) but I was having trouble adding an object like this to the cookies:
https://api.jsonbin.io/v3/qs/637fb32c65b57a31e6c26bfb

However if I delete the array of users it creates the cookie normally, when not deleted it simply generates no error but also does not create the cookie.

(Note: I was doing it by hand, because all the existing persistence libraries weren't persisting, probably due to the same problem, after all they all use nuxt's composable.

fierce basin
#

That one works great for me to persist a store. Just make sure you add the persist: true to it:

import { defineStore } from 'pinia'

export const useStore = defineStore('main', {
  state: () => {
    return {
      someState: 'hello pinia',
    }
  },
  persist: true,
})