Skip to content

3.11 regression when using "elementId" in templates #18147

@kanongil

Description

@kanongil

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

{{my-test elementId="my-id" handler=(action test) value=myValue}}

controllers/application.js

export default Controller.extend({
    myValue: 123,

    test() {
        console.log('not used...');
    },

    init() {
        this._super(...arguments);

        next(() => {
            this.set('myValue', 321);
        });
    }
});

templates/components/my-test.hbs

Empty...

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions