Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

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

@Methuselah96

Description

@Methuselah96

From @lpatalas on Sun, 14 Jan 2018 09:51:15 GMT

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.

Copied from original issue: immutable-js#1474

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions