-
-
Notifications
You must be signed in to change notification settings - Fork 405
Description
One of the more common pieces of feedback we've been receiving so far with the Octane preview is that it's fairly burdensome to write out all of the import paths when writing a simple component:
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';The decisions for these import paths were made carefully and with good reason, but ultimately it's proving fairly unergonomic, and it may make sense to begin re-exporting some of them from a shared location.
We could re-export @tracked and @action from @glimmer/component, but they are also much more general decorators - they can be applied to Controllers, Services, Helpers, etc. We would either have to re-export from each of these for consistency, or force users to learn two potential import paths.
Alternatively, we could group these two decorators, since they are usually applied together anyways. Some possibilities include:
import { action, tracked } from '@ember/object';
import { action, tracked } from '@ember/class-utils';
import { action, tracked } from '@ember/utils';
import { action, tracked } from '@ember/decorators';
import { action, tracked } from '@glimmer/object';
import { action, tracked } from '@glimmer/class-utils';
import { action, tracked } from '@glimmer/utils';
import { action, tracked } from '@glimmer/decorators';The first decision would be whether to group them in an @ember namespace, or a @glimmer namespace. The original decision for import { tracked } from '@glimmer/tracking' was that it would allow us to support interop between stand-alone Glimmer and Ember, so choosing an @glimmer namespace would help with this goal.
However, it would also introduce @action to Glimmer.js, and this may not be an ideal name for the function-binding decorator. The term "action" has a lot of historical baggage in Ember, and doing this would introduce that baggage to Glimmer. If we aren't satisfied with the name @action, re-exporting from an @ember namespace may make more sense. Either way, Glimmer.js will be needing to add a function-binding decorator in the near future, either @action or some other name.