Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when using methods of collections #5

Open
kirillrogovoy opened this issue Sep 12, 2016 · 2 comments
Open

Bug when using methods of collections #5

kirillrogovoy opened this issue Sep 12, 2016 · 2 comments

Comments

@kirillrogovoy
Copy link

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!

@zackify
Copy link
Member

zackify commented Sep 12, 2016

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.

@kirillrogovoy
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants