keajs / kea-localstorage

Persist the state of your reducers in localstorage
https://kea.js.org/plugins/localstorage
MIT License
9 stars 3 forks source link

How to set up Multiple paths #1

Closed mrbarletta closed 6 years ago

mrbarletta commented 6 years ago

Awesome work - I really love Kea, after a while, everything seems easy.

Well, almost :)

I created a path in kea({options like this path: () => ["shownBubbles"], I also added the path in the store ( otherwise doesn't work) like this:

export default getStore({
    paths:['shownBubbles'],
    plugins: [localStoragePlugin, sagaPlugin],
});

But if a add the persist:true to more than one reducer (in the same big Logic file ) then the information get overwritten. Its like all the reducers share the same path instead of allocating their own key.

Thanks!

mariusandra commented 6 years ago

Hey! You found a bug! :)

Indeed all the reducers were sharing the path of the logic store itself.

I released 0.2.0 that should have it fixed.

mrbarletta commented 6 years ago

Oh dear, You don't imagine how much I appreciate your promptness! I will try it out :)

mrbarletta commented 6 years ago

Closing as fixed