zundo
zundo copied to clipboard
`clear` seems to be resetting my entire store state.
Hi.
I think the latest change might have potentially broken clear
from the middleware. When I call it to reset my history, it seems to wipe my entire store and I get Cannot destructure property 'X' of 'myStore(...)' as it is undefined
, when I use my store. I don't think I changed any of my code except updating npm. When I comment my call of clear
out (when I want to reset the store and want a brand new history), it errors.
Hey @jo-sip, thanks for making an issue! I can check this out soon. What will help me debug is reproduction steps or a code sandbox. Thank you!
No worries, here's a simple example that repros the bug. https://codesandbox.io/s/clear-debug-zundo-6rde7m?file=/src/App.tsx
(Add a few, undo, then clear and it'll throw)
Great, thank you! I was able to reproduce the issue. Very strange.
I can look into this! For the time being, I'd roll back to the previous version.
I'm not sure what's wrong with that version.
v2 beta should fix this issue. There is a small API change for accessing undo
and redo
but the readme explains how to use that. Sorry again for the issue and for the delay!
npm i zundo@beta