Skip to content
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

Object.freeze nodes after reconciliation #652

Merged
merged 2 commits into from
Sep 24, 2021

Conversation

trueadm
Copy link
Collaborator

@trueadm trueadm commented Sep 24, 2021

We should make it harder to accidently mutates a node's properties when that node has already been reconciled. The correct pattern is to call this.getWritable() and to write to that (thus invoking the cloning logic). So we can make it a bit harder in DEV mode by calling Object.freeze() on the node after we've reconciled said node.

Copy link
Contributor

@tylerjbainbridge tylerjbainbridge left a comment

Choose a reason for hiding this comment

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

Looks good- thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 24, 2021
@trueadm trueadm merged commit 7da512a into main Sep 24, 2021
@trueadm trueadm deleted the freeze-nodes-after-reconcilation branch September 24, 2021 18:12
acywatson pushed a commit that referenced this pull request Apr 9, 2022
* Object.freeze nodes after reconcilation

* Move Object.freeze to better locations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants