Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#53 (comment)
This change adds a
yewdux-utils
crate with a listener that tracks the history of a state and enables undo/redo.It works very nicely - try running new history example.
There's a couple of issues with it that I would like some feedback on.
Firstly, it should be able to initialize it by just injecting the listener using the attribute macro like this:
but the person who implemented that attribute macro (it was me!) decided to use
PathList
which apparently doesn't support generic types. I've asked on theDarling
repo but I'm pretty sure there's no way to make that work.So you have to initialize it the old way
The other thing is that the undo tracking currently tracks a potentially infinite number of states which could lead to running out of memory quite quickly if you don't clear it periodically. I think it might be better to let you set a limit on the number of states.