This repository was archived by the owner on Jan 2, 2026. It is now read-only.
Repository navigation
Unfiltered snapshots feature - #139
Merged
Merged
Conversation
Closed
This was referenced Dec 14, 2016
…for expected functionality
Owner
|
Thanks a lot for this PR, @davidroeca - looks really good! 👌 |
Owner
|
@davidroeca can you join us on gitter? 😁 |
Owner
|
I published a new version |
This was referenced Dec 20, 2016
Closed
|
This "fix" makes it impossible to create a filter to squash multiple identical actions into one single undo. This fix restores the state after the first action, instead of the state after the last of the multiple actions, which defeats the purpose. Maybe it fixes another use case, but mine seems important too... |
Collaborator
Author
|
Hi @jcdufourd, Strange, when I made this PR I was working with libraries that relied a lot on thunks and had similar behavior in mind. Please reopen #115 or open a new issue and provide a simple case of where this doesn't work out for you. Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This pull request removes the wasFiltered flag (the source of a number of bugs), and replaces it with a _latestUnfiltered state object. The purpose of this object is to track the most recent unfiltered state, in order save the correct state object to the past at the correct time (not too early).
The basic premise:
-When updating new (unfiltered) present state, push _latestUnfiltered to the past stack (if it exists), and update both the present and _latestUnfiltered state objects with the latest state
-When inserting filtered present state, merely update the present state
-When undoing, push the _latestUnfiltered state to the future stack, and update both the present and _latestUnfiltered state objects to the most recent past
-When redoing, push the _latestUnfiltered state to the past stack, and update both the present and _latestUnfiltered state objects to the nearest future
I've also updated the unit tests to account for this; let me know if you have any questions/concerns
Example functionality changes
Actions:
Action A = unfiltered action
Action F = filtered action (typically fired by a thunk for redux form's internal state)
Before this pull request:
1: Action A happens
2: Action F happens <--- line 1's state is added to past (Undo will have to be clicked 1 too many times!)
3: Action F happens
4: Action A happens
5: Action F happens <--- line 4's state is added to past
6. Action A happens
After this pull request:
1: Action A happens <--- snapshot of "most recent unfiltered state" is taken
2: Action F happens
3: Action F happens
4: Action A happens <--- line 1's state is added to past; snapshot of "most recent unfiltered state" is taken
5: Action F happens
6. Action A happens <--- line 4's state is added to past; snapshot of "most recent unfiltered state" is taken