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

[FEAT] Updates decorator implementation to stage 1 #17690

Merged
merged 2 commits into from
Mar 2, 2019

Conversation

pzuraq
Copy link
Contributor

@pzuraq pzuraq commented Mar 1, 2019

This moves us back to stage 1 decorators for our internal decorator implementation. It also reverts to using a Symbol instead of a WeakMap for @tracked values. This is overall a better for perf, assuming we can assign the value of the symbol in the constructor via an initializer. Unfortunately stage 1 decorators don't allow this, but fortunately it should be very easy to add a babel transform specifically for @tracked that does, so we can get the ideal performance.

@pzuraq pzuraq force-pushed the change-decorators-to-stage-1 branch from b340516 to 1a8e287 Compare March 1, 2019 16:45
@rwjblue rwjblue merged commit 2ed6adf into master Mar 2, 2019
@rwjblue rwjblue deleted the change-decorators-to-stage-1 branch March 2, 2019 20:34
@GavinJoyce
Copy link
Member

GavinJoyce commented Mar 2, 2019

I'm seeing Error: Assertion Failed: The options object passed to tracked() may only contain a 'value' or 'initializer' property, not both. Received: [kind,key,placement,descriptor,initializer] for simple @tracked count = 1; in a recent app created with the ember-octane-app-blueprint. Perhaps caused by this change?

Here's the component js:

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

export default class CounterComponent extends Component {
  @tracked count = 1;

  increment() {
    this.count++;
  }
}

The error occurs with the latest ember-source sha (2ed6adf8f3b9386e02808af7caaa0feec290a144), not with a sha from yesterday (d92c83887d58fa0aaf9ffcf51d894044f3711e81)

@pzuraq
Copy link
Contributor Author

pzuraq commented Mar 2, 2019

The octane app blueprint needs to be updated to use the stage 1 decorator transforms. We can install @ember-decorators/babel-transforms@v2 for now

@GavinJoyce
Copy link
Member

Thanks, here's a PR to downgrade babel-transforms in the octane blueprints:

ember-cli/ember-octane-blueprint#58

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

Successfully merging this pull request may close these issues.

3 participants