Skip to content

Patch for array.pop() replaces "length" #208

@aleclarson

Description

@aleclarson

Let's assume array = [ 0 ]. Should array.pop() result in { op: "remove", path: [ "0" ] } instead of { op: "replace", path: [ "length" ], value: 0 }?

I guess Immer is already "breaking" from the spec by making path an array and not /foo/bar, but you could argue replacing length isn't friendly to non-JS environments.

I assume the current behavior improves performance slightly.

https://codesandbox.io/s/0o1zx5226l

  • Version: 1.7.2
  • Occurs when using Proxies (use setUseProxies(true))
  • Occurs in the ES5 implementation (use setUseProxies(false))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions