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

Filtered sequence + take + react 0.13 hangs #394

Closed
kentor opened this issue Mar 16, 2015 · 2 comments
Closed

Filtered sequence + take + react 0.13 hangs #394

kentor opened this issue Mar 16, 2015 · 2 comments

Comments

@kentor
Copy link

kentor commented Mar 16, 2015

Wasn't sure if I should file this here or at the react project.

Very bizarre, this code crashes in latest Chrome and Firefox for me:

var data = Immutable.List([1])
  .toSeq()
  .filter(_ => true)
  .take(1)

React.createElement('div', null, data);

Using react 0.13 and immutable-js 3.6.4

JSBin: http://jsbin.com/qoyimuneqo/2/edit?html,js,output (might crash tab, firefox handles it better for me)

Taking out the line with filter or the take will work as usual.

edit: removed 6to5/jsx dependency

@kentor
Copy link
Author

kentor commented Mar 17, 2015

From my debugging, it gets stuck in the while loop in validateChildKeys

  } else if (node) {
    var iteratorFn = getIteratorFn(node);
    // Entry iterators provide implicit keys.
    if (iteratorFn) {
      if (iteratorFn !== node.entries) {
        var iterator = iteratorFn.call(node);
        var step;
        while (!(step = iterator.next()).done) {
          if (ReactElement.isValidElement(step.value)) {
            validateExplicitKey(step.value, parentType);
          }
        }
      }
    } else if (typeof node === 'object') {

digging in deeper, this line in immutable is an infinite loop:

      return new src_Iterator__Iterator(function()  {
        while (skipped++ !== resolvedBegin) {
          iterator.next();
        }

skipped is 1 and resolvedBegin is 0

@kentor kentor changed the title Filtered sequence + take + react 0.13 crashes browser Filtered sequence + take + react 0.13 hangs Mar 17, 2015
@leebyron
Copy link
Collaborator

Thanks for the report! I'll dig into this

ellbee added a commit to ellbee/immutable-js that referenced this issue Mar 26, 2015
@kentor kentor closed this as completed Apr 28, 2015
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