Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Record current values in the bindings map #2099

Closed
wants to merge 1 commit into from

Conversation

hermanventer
Copy link
Contributor

@hermanventer hermanventer commented Jun 8, 2018

Release note: none

Effects objects are currently stateful: If you apply the effects it becomes an undo map and if you undo the effects, it becomes a redo map.

In most situations this is just fine since apply and undo are usually nicely paired. In some situations, however, we end up applying or undoing the same effects object twice in a row. This causes issues that are extremely hard to debug. I've tried to purge the code base of all such cases, but they just keep coming up. In essence, I am trying to maintain a very subtle invariant that is quite hard to check and I am failing.

I now give up on this invariant and am making Effects into an object that is immutable except when being constructed incrementally. This is the first step towards that.

@trueadm
Copy link
Contributor

trueadm commented Jun 8, 2018

@hermanventer I just checked this out and the failing React test seems to be a failing Jest snapshot. The snapshot looks to have been recording something that should have been failing, so this PR actually fixes a previous regression! If you update the snapshot on your PR, the test will pass (yarn test-react -u).

@hermanventer hermanventer changed the title WIP: Record current values in the bindings map Record current values in the bindings map Jun 8, 2018
Copy link
Contributor

@NTillmann NTillmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanventer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@hermanventer
Copy link
Contributor Author

Updated this to no longer require recordModifiedBinding to update the map entry on every modification. This makes the code simpler and also will be consistent with the (only reasonable) way that property bindings will be tracked.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanventer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants