Sometimes I have a zustand state where I add top-level keys dynamically. For example, it might start off like:
useSomething = create(()=>({}))
Then I might later do:
useSomething.setState({[some_id]: some_value})
If undo/redo is merging past states into the current state, then the "some_id" won't be removed.
I'm guessing it is merging, based on this line:
It's not a big deal, as I can just add a permanent top-level key and put the dynamic keys inside of that. Adding an option to overwrite state could be nice though, unless there's a way to do that already.
Sometimes I have a zustand state where I add top-level keys dynamically. For example, it might start off like:
Then I might later do:
If undo/redo is merging past states into the current state, then the "some_id" won't be removed.
I'm guessing it is merging, based on this line:
zundo/src/temporal.ts
Line 25 in 65a1c99
It's not a big deal, as I can just add a permanent top-level key and put the dynamic keys inside of that. Adding an option to overwrite state could be nice though, unless there's a way to do that already.