Skip to content

List.delete() sets element to empty array instead of removing it #1474

Closed
@lpatalas

Description

@lpatalas

Hello.

I'm using Immutable.js v4.0.0-rc.9 with react-native v0.50.4.

If I run the following code snippet:

const list1 = List.of(1, 2, 3);
const list2 = list1.delete(1);
console.log(`list1`, list1.size, list1);
console.log(`list2`, list2.size, list2);

I get this output in the console:

01-14 10:22:26.568  4347  4982 I ReactNativeJS: 'list1', 3, { size: 3,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _origin: 0,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _capacity: 3,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _level: 5,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _root: null,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _tail: { array: [ 1, 2, 3 ], ownerID: undefined },
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   __ownerID: undefined,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   __hash: undefined,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   __altered: false }
01-14 10:22:26.568  4347  4982 I ReactNativeJS: 'list2', 3, { size: 3,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _origin: 0,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _capacity: 3,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _level: 5,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _root: null,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   _tail: { array: [ 1, [], 3 ], ownerID: {} },
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   __ownerID: undefined,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   __hash: undefined,
01-14 10:22:26.568  4347  4982 I ReactNativeJS:   __altered: false }

So basically it seems that the element is replaced by empty array instead of being removed from collection. It only happens when running without debugger attached, so I guess it may be dependent on JS engine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions