Skip to content

Use "add" and "remove" in preference to "replace"? #5

Description

@kcarnold

I don't think that https://github.com/intelie/immutable-js-diff/blob/master/tests/sequenceDiff.test.js#L71 is the desired behavior; rather, it should be:

[{op: 'remove', path: '/2'},
 {op: 'add': path: '/3', value: 5}]

Note that this diff does not include 4, which did not change. Why this matters:

  1. If 4 was instead some large data structure, the patch would be unnecessarily large
  2. If we were using the patches to track the history of a single item, this patch would introduce a discontinuity in the history of 4.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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