Skip to content

feat: add object/array diff checking to Observer Map #7192

@janechu

Description

@janechu

🙋 Feature Request

Currently there is no mechanism to check whether a particular deeply nested array item or object property has changed vs not changed when setting an object from (for example) the property on the custom element class.

Because we know the object structure from the generated JSON schema, we can use that to determine when setting an object which properties to change and only change/re-observe those.

🔦 Context

Example HTML:

<my-component :obj="{{obj}}"></my-component>

Example JSON (before):

{
    "foo": {
        "bar": "a",
    },
    "bat": [
        {
            "a": "b"
        }
    ]
}

Example JSON (after):

{
    "foo": {
        "bar": "b",
    },
    "bat": [
        {
            "a": "b"
        }
    ]
}

Only foo.bar has changed therefore only set that item, if it is an primitive simply update the value, if it is an object itself re-proxy it.

Note: There may be perf implications to this? It does simplify DevEx.

Requirements

  • Check objects for differences
  • Check arrays (go through each item for differences, rationalize against additions, removals)

Metadata

Metadata

Labels

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions