Open mishka86 opened 2 years ago
I encountered the same problem, to solve it while waiting for a patch, it is possible to add a condition on the storage process.client
. That way, it will be ignored on the server-side.
Example of code:
// store/index.ts
export const useState = defineStore('keyValue', {
// states & actions & getters
//
//
//
persist: {
enabled: true,
strategies: [
{ key: "keyValue", storage: process.client ? sessionStorage : null },
]
}
})
There is no problem when using the Basic Usage method. When using separate storage(localStorage, sessionStorage) for strategies in Advanced Usage I get an 'is not defined' error. Do I need any special settings?