Discourse seems upgraded to Ember Octane already but does not support some new features yet.
I know that possible huge workload to migrate the existing component in Discourse, but we would love to use these new features in our new plugin, so would it be possible before completing the whole migration?
For now, my component which extends the
@glimmer/component will get Assertion Failed error:
Glimmer Components - Octane Upgrade Guide - Ember Guides Benefits of Glimmer Components
Glimmer components have some huge benefits:
These new components give you all the benefits described in Native Classes above
They don’t extend from
EmberObject at all, which means that they don’t need
EmberObject APIs, such as
extend . You can safely use
constructor for all setup code.
Lifecycle hooks are greatly simplified and easier to use
They don’t have that wrapping HTML element that got in the way of CSS styling and layout
Arguments are also namespaced on
this.args within Glimmer components, which is an immutable object. This means that:
It’s clear when you are accessing arguments passed to the component, and when you are accessing fields and properties of the component itself.
Arguments always refer to the original value that was passed in, so you don’t have to track down confusing code in hooks or computed property definitions that modifies the value of the argument.
There is no confusing two-way data binding for arguments via the component class, data can only flow in one direction.
We are currently working on this and Discourse will start using glimmer components in the next few months.