-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
3.11 regression when using "elementId" in templates #18147
Comments
Thank you for reporting! |
@rwjblue - is this on the roadmap for a fix soon? We cannot update past 3.10 because of this bug and I'll have to start thinking for workarounds if this is not something that is going to be fixed in a patch release. Thanks! |
I'm definitely keen on getting a fix into a patch release, but I haven't had a chance to dig in to find the right fix yet. |
@rwjblue - ok, thanks, no worries, take your time, I just wanted to know if I had to think of workarounds. |
I remember being able to "fix" this by passing I contributed this to passing |
@simonihmig - thanks for the idea! I was finally able to update to 3.11. :) I still do think that this is a bug though and has to be researched. |
Definitely agree that this needs to be fixed, just haven't had time to dig into it. |
I just ran into this when trying to upgrade my app yesterday 😀 Looks like the workaround will work for us too, so thanks @simonihmig! |
Just ran into this yesterday as well when upgrading to 3.12, glad to at least see a work-around :). Is |
* DEV: Use Ember 3.12.2 * Add Ember version to ThemeField's DEPENDENT_CONSTANTS * DEV: Use `id` instead of `elementId` (See: emberjs/ember.js#18147) * FIX: Don't leak event listeners (bug introduced in 999e2ff)
@rwjblue and I just figured out what we need to do to fix, and I'll have a PR with both failing tests and a fix for it in a little bit! Thanks for the reports and the workarounds! |
Thanks for working on this @chriskrycho! Assuming the fix is as "simple" as we expect, I think we'll be able to backport to 3.16 and 3.12. |
When refactoring from observers to setters during the 3.11 release (in 405d423), an apparently-transparent change caused a regression around invocations of components including `elementId=...`. *Any* rerender of the component which included `elementId` assignment now triggered the assertion, rather than *only* changes which actually updated the value of `elementId`, because all invocations strigger a `set` on the property. The simplest reproduction of this bug (given a component `foo-bar`): {{foo-bar elementId='stable' changingValue=this.fromBackingClass }} Changing the value `fromBackingClass` on the backing class *always* triggers the assertion, even though it is actually impossible for it to change the `elementId` value, because the assertion in the setter throws regardless of what the value is. (The observer-based did not throw in the same conditions because it would not retrigger when the observed key on the view did not change.) The fix is to check equality between the passed `elementId` value and the previously set value, and only throw if they differ. Fixes #18147 (cherry picked from commit da8c466)
I think this issue is caused by a current regression in ember emberjs/ember.js#18147 but using `id` works just fine in templates. This also appears to be the only template file we are using `elementId` directly in the template.
When refactoring from observers to setters during the 3.11 release (in 405d423), an apparently-transparent change caused a regression around invocations of components including `elementId=...`. *Any* rerender of the component which included `elementId` assignment now triggered the assertion, rather than *only* changes which actually updated the value of `elementId`, because all invocations strigger a `set` on the property. The simplest reproduction of this bug (given a component `foo-bar`): {{foo-bar elementId='stable' changingValue=this.fromBackingClass }} Changing the value `fromBackingClass` on the backing class *always* triggers the assertion, even though it is actually impossible for it to change the `elementId` value, because the assertion in the setter throws regardless of what the value is. (The observer-based did not throw in the same conditions because it would not retrigger when the observed key on the view did not change.) The fix is to check equality between the passed `elementId` value and the previously set value, and only throw if they differ. Fixes #18147 (cherry picked from commit da8c466)
After upgrading my code to 3.11, I receive an error:
"Error: Changing a view's elementId after creation is not allowed"
.Since I don't change the
elementId
anywhere in my code, and the new value is identical to the recorded value, I have explored further and found it to be a new bug.I can trigger the issue with the following:
templates/application.hbs
controllers/application.js
templates/components/my-test.hbs
You can find failing copy here: https://github.com/kanongil/ember-fail
Note that I also tested it with angle-bracket components, and here it doesn't fail until I make the value
{{mut}}
.It seems that the bug is triggered by a combination of using elementId, an action handler, and a mutable value that is set after it has been rendered.
The text was updated successfully, but these errors were encountered: