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

breaks on {{#if}} direct inside {{#vertical-collection}} #26

Closed
luxzeitlos opened this issue Apr 4, 2017 · 9 comments
Closed

breaks on {{#if}} direct inside {{#vertical-collection}} #26

luxzeitlos opened this issue Apr 4, 2017 · 9 comments

Comments

@luxzeitlos
Copy link
Contributor

This template:

<section>
  {{#vertical-collection data
    minHeight=10
    containerSelector="body"
    alwaysRemeasure=true
    as |item|
  }}
    <section>
      Item {{item.id}}
    </section>
    {{#if item.detail}}
      <section>
        Detail
      </section>
    {{/if}}
  {{/vertical-collection}}
</section>

with this data:

data: Em.computed({
  get() {
    const arr = [];
    for(let i = 0; i < 1000; i++) {
      arr.pushObject({
        detail: true,
        id: i
      });
    }

    return arr;
  }
})

breaks with

Error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
at Object.clear (ember.debug.js:45707)
at UpdatableBlockTracker.reset (ember.debug.js:46044)
at TryOpcode.handleException (ember.debug.js:54858)
at UpdatingVMFrame.handleException (ember.debug.js:55040)
at UpdatingVM._throw [as throw] (ember.debug.js:54753)
at Assert.evaluate (ember.debug.js:50122)
at UpdatingVM.execute (ember.debug.js:54740)
at RenderResult.rerender (ember.debug.js:54679)
at RootState._this.render (ember.debug.js:12161)
at runInTransaction (ember.debug.js:23478)

I'm not sure if this should be supported, but it AFAIK worked in smoke-and-mirrors.

@scottmessinger
Copy link

I ran into the same error when I had an each as the only thing in the vertical-collection block. Given I was having the same error as using an if, I figured it might be because there's a tagless component so I wrapped the each in a div and things worked. Any ideas on how to fix it? Or where to look to patch it?

@pzuraq
Copy link
Contributor

pzuraq commented Apr 4, 2017

This is related to #24, it has to do with the way we are moving DOM around to avoid thrashing Glimmer. We may be able to avoid these issues if we remove the .virtual-component-renderer div and just render the VCs directly to the main component element, but that could also cause more issues - we'll have to play around with it.

It may be a hard requirement to have a stable root element in place, similar to ember-wormhole, until the Custom Components RFC lands. I'm hoping that will enable us to extend Glimmer in a better way than we are currently.

@luxzeitlos
Copy link
Contributor Author

Should we treat this as a documentation issue then for now?

@pzuraq
Copy link
Contributor

pzuraq commented Apr 5, 2017

I'm going to try to solve it for beta 2 next week, but if that doesn't work then yes we should.

@runspired
Copy link
Contributor

@pzuraq with the virtual bounds this should not be an issue. We may have implemented the bounds moving logic incorrectly.

@pzuraq
Copy link
Contributor

pzuraq commented Apr 5, 2017

Yeah, that's what I'm thinking. I think we need to go back to the original design you implemented, where the virtual bounds were used for the VC each instead of a div container, that's what's tripping Glimmer up. I'll be able to take a look at it first thing next week.

@pzuraq
Copy link
Contributor

pzuraq commented Apr 11, 2017

@scottmessinger @luxferresum I should be getting beta.2 out this week or early next with this patch in! Let me know if the issue is fixed on your end, I think this should be solid

@luxzeitlos
Copy link
Contributor Author

I can confirm that it's now working on master.
For now this is a "works on my machine", but I will push it to testing as soon beta.2 is out.

@HenryVonfire
Copy link

I'm having the same error with 1.0.0-beta.13 while trying to change the collection of items while filtering them @pzuraq @runspired

Is vertical-collection meant to work only with non-mutable collections?

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

5 participants