Closed maziarz closed 5 years ago
@maziarz i have same issue
Thank you! This issue is fixed now
Thanks! While the second error has been eliminated i still receive this one:
Cannot read property 'expire' of null
https://github.com/rubystarashe/nuxt-vuex-localstorage-example
try this example
I tried to add copy[key] !== null
in the conditional code, but obviously it does not feel right, but it gets the job done. I have used your example and replicated it into my project, i have similar approach.
if (copy[key] !== null && typeof copy[key].expire === 'number')
expire create event is only run when store has changed. so in right case, copy[key] is always has value. it seems the store watcher event run when before module init
can i check your whole example repo? i think i have to test more in detail
expire create event is only run when store has changed. so in right case, copy[key] is always has value. it seems the store watcher event run when before module init
can i check your whole example repo? i think i have to test more in detail
I have several store modules, but i only utilise your plugin for one of the store modules. I have a some legacy code which is running vue-localstorage
in a store module, but i do not expect that this should collide with your plugin. I just added some printout in the code, and it is indeed null
for some values, which is causing the error. Not sure if i am able to build a minimum example of this code as it is a pretty big project. But i will see what i can do.
I found the problem, i initialise one of my states with null
: selected_category: null
. That causes the error.
In that case, there may be a few props can has null value.
try use this code
if (copy[key] !== null && typeof copy[key].expire === 'number')
or
if (typeof (copy[key] || {}).expire === 'number')
Works perfectly! 👍
xD You found it while I was writing down my answers.
I will update that after check logical errors.
Thank you!
Your welcome, thank you for an excellent module! 🎉
I have installed this module in a SPA, but i am receiving two errors in runtime. Here is the implementation for the sake of sanity:
nuxt.config.js
store/teamCreation.js
The errors: