Skip to content

setDeep doesn't return a full new object #1596

@FedericoBonel

Description

@FedericoBonel

Description

Right now it is a bit confusing that the docs state that setDeep returns an object with the updated value. While this is true, it will not return a fully deep-cloned object. Instead, it only returns a top-level copy, and any nested objects retain the same reference as the original. This can easily be confusing and is prone to bugs unless handled correctly.

We should either document that setDeep does not return a fully deep-cloned object of the object passed in, or support full deep cloning.

Considerations

  • This is the page that documents setDeep.
  • Deep cloning an object can be heavy for performance depending on when people call it. The user who reported this confusion was using it on every resolveData, which means every keystroke or field change would trigger it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions