Skip to content

feat: add deep-merge logic to observer map #7484

@janechu

Description

@janechu

🙋 Feature Request

There currently exists a deepMerge function to assist the ObserverMap when setting objects that contain Proxy elements. In a situation where complex data should not get reset this should merge with the current data.

💁 Possible Solution

On the JSON schema that is generated we currently add an $observe property to indicate to the ObserverMap that this property gets observation. We can add another property $deepMerge that will merge any item corresponding to it when it is set without having to setup Proxy again or lose observations on it's properties.

🔦 Context

As part of Developer Experience, it may be easier to set an entire object rather than multiple individual properties on that object at once.

Open Questions

  • Should this remain a standalone utility
  • Should it be part of ObserverMap or should ObserverMap simply check for object equality
  • Should there be a configuration for ObserverMap that uses deepMerge and applies it selectively to the JSON schema so that anytime a path is set it uses the deepMerge logic
  • Should we add more testing around ObserverMap with regards to re-render thrashing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions