Skip to content

Bug when using methods of collections #5

Description

@kirillrogovoy

Hi!

I see that List's property length is proxied to become size which is the right one for Immutable.

Here's a piece of code:

const {List} = require('immutable-proxy')

const list = List([1, 2, 3])
console.log('List size: ', list.length) // 3
console.log('Filtered list size: ', list.filter(() => true).length) // undefined

You see, since all "modifying" methods return a new object, ImmutableJS creates a new one internally, which is, obviously, isn't proxied!

This bugs totally destroys a potential use of this package, unfortunately. It's just a tip of the scale, the problem exists in any collection methods which return a new object!

Activity

  1. zackify commented on Sep 12, 2016

    @zackify
    Member

    This was never fully thought out, so there's going to have to be changes to support filtering and other array methods. It's been a while since I messed with this.

  2. kirillrogovoy commented on Sep 12, 2016

    @kirillrogovoy
    Author

    As far as I see, you didn't actually get to using this project yourself, did you? :) Were there any specific issues why you chose not to? Or did you stopped using Immutable.js at all? I would glad to hear more on that, so I would know whether to spend more time on this or not in future.

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