Skip to content

Address some issues where spread operator was used but deep copy needed#10803

Merged
sean-mcmanus merged 4 commits intomainfrom
coleng/deep_copies
Apr 11, 2023
Merged

Address some issues where spread operator was used but deep copy needed#10803
sean-mcmanus merged 4 commits intomainfrom
coleng/deep_copies

Conversation

@Colengms
Copy link
Copy Markdown
Contributor

The spread operator only copies 1 level deep. Any objects or arrays the source object will be 'referenced' by the new object, not copied.

Updated existing uses of the spread operator where it looks like a deep copy was intended.

Uses the module lodash for its cloneDeep function. But we could roll our own instead, if that would be preferable.

@sean-mcmanus sean-mcmanus merged commit 8bf5d6e into main Apr 11, 2023
@sean-mcmanus sean-mcmanus deleted the coleng/deep_copies branch April 11, 2023 22:12
@github-actions github-actions Bot locked and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants