Skip to content

Fails for case of newly added property with a value of null #7

@zwilliam88

Description

@zwilliam88

A simple test case:

    it 'should properly handle new null property', ->
      before = {}
      after = { newProp: null }
      changesets.applyChanges before, changesets.diff before, after
      expect(after).to.eql before

Fails with "TypeError: Cannot read property 'length' of undefined"

if change.value? or change.type is changeset.op.REMOVE

should probably be:

      if !change.changes

In its current form applyChanges calls applyBranchChanges for the add of a new property with a value of null. applyBranchChanges expects a changes array to exist on the change and calls length on undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions