-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Summary: This is one possible fix for #2192, which simply checks if objects are frozen before attempting to modify them. Do note that while this fixes my use case and any others that are serialized as simple JSON-compatible types, this won't fix cases where a custom scalar is [hydrated to a more complex type](#91), such as a `Date` object. For this, you may want to consider adding a check to skip the recycle if the inputs aren't simple objects or arrays: ```es6 if ( Object.getPrototypeOf(nextData) !== Object.getPrototypeOf(prevData) || ( Object.getPrototypeOf(nextData) !== Object.prototype && Object.getPrototypeOf(nextData) !== Array.prototype ) ) { return nextData; } ``` But, since this may have more consequences, and I would really like my use case fixed ASAP 😜 I've omitted that "fix" from this PR. Please let me know if you'd like me to open a separate issue for that. Pull Request resolved: #2193 Reviewed By: josephsavona Differential Revision: D6845724 Pulled By: jstejada fbshipit-source-id: 2a96bb45b349334db51304bac393b7539ee00448
- Loading branch information
1 parent
c1422d3
commit 4173a5e
Showing
2 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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