Skip to content

changeset.snapshot() does not work with nested keys #24

@SergeAstapov

Description

@SergeAstapov

Here is quick reproduction: https://codesandbox.io/s/infallible-meadow-yzt61

Looks like it's been working just fine in ember-changeset@2 because this._changes had format:

{
  "firstName": "Jim",
  "lastName": "B",
  "address.city": "NYC",
  "address.state": "NY"
}

validated-changeset has structure like

{
  "firstName": "Jim",
  "lastName": "B",
  "address": {
    "city": "NYC",
    "state": "NY"
  }
}

so this iteration fails https://github.com/validated-changeset/validated-changeset/blob/master/src/index.ts#L558-L561

Also, changes getter does not work as expected as it returns

[
  {
    "key": "firstName",
    "value": "Jim"
  },
  {
    "key": "lastName",
    "value": "B"
  },
  {
    "key": "address.city",
    "value": "NYC"
  },
  {
    "key": "state",
    "value": "NY"
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions