vuejs-storage
vuejs-storage copied to clipboard
Fix merge when object is undefined
Please check changes in merge.ts. That allows restoring initial null object from storage.
Codecov Report
Merging #40 (2b44bb7) into master (57721d9) will not change coverage. The diff coverage is
100.00%.
@@ Coverage Diff @@
## master #40 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 98 99 +1
Branches 13 14 +1
=========================================
+ Hits 98 99 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/merge.ts | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 57721d9...731db17. Read the comment docs.
Could you add a test case about this change?
Hi mapple3142.
In my app, I have vuex namespaced two modules. On system module, it does have a state called "auth" which is an object like the below:
auth = { token: '.....hold jwt token...', access: { 'GET/system/user': true, 'GET/system/role: true }, user: { id: 'some-guid', name: 'xxxx', } }
So, configure vuejs-storage to persist "system.auth" state. It writes OK on localStorage, but when I try to reload app it's raising an exception that could not use operator "in" to retrieve "user". I guess the "merge" code I propposed creates an empty "user" object so it can interacts creating user attrs id and name.
Hope this helps to understand. If not I'll try to give you an sample app.
Thanks for your attention.
I had similar problems with attributes containing null values