Closed cgrisar closed 1 year ago
Thank you for a great plugin.
May I suggest to adapt the docs according to a bug I had last night?
I write my vues, including the pinia stores along the script setup syntax
script setup
So, I was struggling a few hours on a
'set' on proxy: trap returned falsish for property bug
'set' on proxy: trap returned falsish for property
The property that lifted the error was a getter (computed, read-only).
Using
{ persist: { enabled: true } }
will persist all the variables, including the getters.
Navigating from page to page or refreshing a page will try to set a getter though a getter is read-only.
Solution:
you must use strategies and restrict the variables that are persisted with path (and avoid having a getter in the path)
{ persist: { enabled: true, strategies: { path: ['state_variable_1', 'state_variable_2', '...] // avoid getter in the list } } }
Thank you for a great plugin.
May I suggest to adapt the docs according to a bug I had last night?
I write my vues, including the pinia stores along the
script setup
syntaxSo, I was struggling a few hours on a
'set' on proxy: trap returned falsish for property
bugThe property that lifted the error was a getter (computed, read-only).
Using
will persist all the variables, including the getters.
Navigating from page to page or refreshing a page will try to set a getter though a getter is read-only.
Solution:
you must use strategies and restrict the variables that are persisted with path (and avoid having a getter in the path)