Closed kairyu closed 4 years ago
Hi! Thanks for raising the issue!
The fix wasn't the right one unfortunately, as logic.path
exists for every logic, including those that didn't have a path explicitly set. So I changed it to check if there is either no input.path
or if logic.path
starts with kea.inline.
. In that case there was no path explicitly set.
There was another and probably bigger issue though. On logic.extend, the plugin was saving into localstorage all the reducers for a second time. I fixed that by adding code that caches if a reducer has already been persisted or not.
All of that is now out with v1.0.1
:)
Thanks again for finding, documenting and trying to fix the bug! 👍
Thank you very much for looking into the issue and figuring out the proper solution in short time! I'm looking forward to the releasing of the fixed code.
Hey, 1.0.1
is already released with the patch. I now also pushed the updated code to github, sorry it got blocked before!
First of all, thank you for the great plugin!
Recently I tried to use
kea-localstorage
andkea-router
together in a project, and I found I kept getting the error "Logic store must have a path specified in order to persist reducer values" from console even if I have exactly defined the path as well.I have written a minimal working example which can reproduce this issue: https://github.com/kairyu/kea-localstorage-example
At the end of the day, I found it seems that because
kea-router
useslogic.extend()
to extend therouter
logic which has no path specified, the extended logic will also be passed into thebuildStep
ofkea-localstorage
as input, and then it causes the error message.So I thought of a quick fix which just simply change the
input.path
tologic.path
. But I'm not sure does it really make sense. It would be great if you could get any chance to review this. Thank you in advance.