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

Ember 3.17 - helper re-computation in {{each}} #18990

Closed
22a opened this issue May 22, 2020 · 3 comments
Closed

Ember 3.17 - helper re-computation in {{each}} #18990

22a opened this issue May 22, 2020 · 3 comments

Comments

@22a
Copy link

22a commented May 22, 2020

Since ember-source 3.17.0-beta.1, helpers rendered inside an {{each}} block are re-computed/re-rendered when the passed list changes by reference. In these scenarios, the existing helper content is removed from the DOM and re-appended.

This has led to a few issues in our app with event targets not being present in the DOM by the time the event has propagated to any global event listeners (on the document/window).

Minimal reproduction

I’ve put together an reproduction of this in a component by invoking ember-inline-svg inside an {{each}} block in a fresh app: https://github.com/22a/ember-helper-re-render-repro

The example is a little contrived in how it induces the {{each}} re-evaluation, but it does illustrate that, since 3.17.0 (through present: 3.18.1), helpers are being torn down and re-appended to the DOM where components / elements don’t.

<=3.16.8

Screenshot 2020-05-22 at 15 44 52

>= 3.17.0-beta.1

Screenshot 2020-05-22 at 15 01 25

While I show a click on a path in both screenshots above it happens equally to the svg node - I can simplify this reproduction further to a helper that simply inserts a div if that would be helpful.

@rwjblue
Copy link
Member

rwjblue commented May 22, 2020

I believe this is a duplicate of an issue that was fixed in 3.18.1. Can you update and confirm?

@rwjblue
Copy link
Member

rwjblue commented May 22, 2020

Hmm, sorry, I see now that you mentioned that the demo still shows the described behavior on 3.18.1.

@rwjblue
Copy link
Member

rwjblue commented Jun 16, 2020

This was fixed in glimmerjs/glimmer-vm#1100, which is released in 3.19.0. I confirmed in the reproduction you provided.

@rwjblue rwjblue closed this as completed Jun 16, 2020
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