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

Issue deprecations for tracked mutation in constructor during rendering #19282

Merged
merged 2 commits into from
Nov 20, 2020

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Nov 19, 2020

During recent refactors that landed in glimmer-vm@0.57 (Glimmer VM version that landed in Ember 3.22) we moved the internal infrastructure to ensure everything was in a tracking frame. This greatly increased the number of locations that would now fall under the standard read + write assertions.

For example, in glimmer-vm@0.56 the following would run without error:

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';

export default class extends Component {
  @Tracked counter = 0;

    constructor() {
      super(...arguments);

      this.counter++;
    }
}

Now, obviously this is a bit contrived, but the point is that since component construction was not previously within a tracking frame it would not error due to the read then write of a tracked property.

As of glimmer-vm@0.60+ we do run this within a tracking frame (because nearly everything is automatically within a tracking frame).


This change ensures that the (previously untracked) construction of components, modifiers, and helpers trigger a deprecation not an assertion when mutating a previously read value within the constructor. In order to do that some changes were required in GlimmerVM (primarily glimmerjs/glimmer-vm#1205).

Fixes #19192
Fixes #19272 (by updating glimmer-vm)

Includes the following bugfixes:

* [#1209](glimmerjs/glimmer-vm#1209) Ensure `<output form="some-value">` works properly
* [#1205](glimmerjs/glimmer-vm#1205) Ensure `@tracked` assertion can be made a deprecation
* [#1204](glimmerjs/glimmer-vm#1204) Ensure `loc` is populated by `build ers.element(...)`

Changelog here:

https://github.com/glimmerjs/glimmer-vm/releases/tag/v0.66.1
@rwjblue rwjblue force-pushed the deprecate-tracking-in-component-manager-constructor branch from 6f00b74 to f0bb6c3 Compare November 20, 2020 15:40
…endering

During recent refactors that landed in glimmer-vm@0.57 (Glimmer VM
version that landed in Ember 3.22) we moved the internal infrastructure
to ensure **everything** was in a tracking frame. This greatly increased
the number of locations that would now fall under the standard read +
write assertions.

For example, in glimmer-vm@0.56 the following would run without error:

```js
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';

export default class extends Component {
  @Tracked counter = 0;

    constructor() {
      super(...arguments);

      this.counter++;
    }
}
```

Now, obviously this is a bit contrived, but the point is that since
component construction was not previously within a tracking frame it
would **not** error due to the read then write of a tracked property.

As of glimmer-vm@0.60+ we **do** run this within a tracking frame
(because nearly everything is automatically within a tracking frame).

---

This change ensures that the (previously untracked) construction of
components, modifiers, and helpers trigger a deprecation **not** an
assertion when mutating a previously read value within the constructor.
@rwjblue rwjblue force-pushed the deprecate-tracking-in-component-manager-constructor branch from f0bb6c3 to 3a613d6 Compare November 20, 2020 15:46
@rwjblue rwjblue changed the title [BUGFIX release] Ensure component creation issues deprecation for tracked property mutation [BUGFIX] Ensure component creation issues deprecation for tracked property mutation Nov 20, 2020
@rwjblue rwjblue marked this pull request as ready for review November 20, 2020 15:48
@rwjblue rwjblue changed the title [BUGFIX] Ensure component creation issues deprecation for tracked property mutation [BUGFIX] Issue deprecations for tracked mutation in constructor during rendering Nov 20, 2020
@rwjblue rwjblue changed the title [BUGFIX] Issue deprecations for tracked mutation in constructor during rendering Issue deprecations for tracked mutation in constructor during rendering Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Cannot set form attribute of <output> Backtracking assertion "more aggressive" in 3.22
2 participants