-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds a basic undo/redo implementation using 'fast-json-patch' #811
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great start. Thanks!
@raineorshine I've made some changes to the code and the basic
|
Here's what I found:
|
Steps to Reproduce
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do a more detailed review of the code itself after some of the above bugs are fixed, but my initial inspection is positive. Thanks for taking the time to organize the code nicely.
Fixed it in the latest commit
Fixed now.
Updated
Sure. I've made the changes in the latest commit.
@raineorshine Do you mean the
I wasn't able to replicate this. I tried with some other |
Couldn't replicate this as well. I'll try to share a screencast for the same. |
Done |
Yes, still occurring for me on 61835d7 in Chrome. |
The |
Steps to Reproduce
Current BehaviorThe first If Expected BehaviorThe second |
That dead undo represents the |
Okay, I was replicate it now. We were using different ways to trigger 'delete'. The reason for this error that we're getting - After a delete operation, when we manually close the alert box, the value of From my understanding of our current approach for https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state |
Okay, great. What solution do you propose?
Yes, storing a component in the |
I inspected all the occurrences of the
|
So far, we've found out two fatuous occurrences of |
That's a great explanation, thanks! Since that's the only place it's used, and we are adding real Undo functionality, I'd say we can remove the Undo button completely and use a regular alert.
Agreed
This sounds right to me. My only question is whether it needs to be more general, or if I guess we can start with your proposed solution and then expand it if we discover there are more dead undo states. Could you take 15 minutes or so to try a variety of different actions and see if there are any other dead undo states? If not, then proceed with the proposed solution. If there are, incorporate that into your analysis and see if you can find a solution that handles both cases in as generic way as possible. Thanks! |
Makes sense. Let's create a new issue for this one and fix it quickly
Thanks! I'll do that |
Created #837 |
After some further digging, I found out that there's another gratuitous issue - There are some state representations that we might not want to be replicated. In this case, it's the appearance of the |
…atches respectively
…ions from patch/inverse-patch
…isible UI changes)
…rtcuts | minor refactoring
…, and dead action handling
…e action | adds tests for same
Beautiful! Thanks! |
Fixes #105
This adds a
store-enhancer
to allow creatingpatches/inverse-patches (diffs)
between the states associated with allundoable
actions, and also two reducers, forundo
andredo
operations respectively.The purpose of this draft is to get the approach verified and identify any bottlenecks that we see at this point.