What’s the recommended way to override a component’s args in a sub-class? Normally composition is preferred by convention in glimmer/ember, but here’s a case where it gets a bit crazy:
Here I have a complex BaseComponent, and the desire is to specialize only one argument ("@arg12") but to do so, I need to pass through all 46 (potentially missing new additions to the underlying component) just to override the one argument.
Ideally there would be a “splarguments” (like “splattributes”) where I could do so with …@args or something, but I don’t see how to get around this, except potentially to import @glimmer/runtime and use curry explicitly to manufacture a CurriedValue, but that seems like a very technical lift.
{{!-- MySubClassComponent/template.hbs --}}
<BaseComponent
@arg1={{@arg1}}
...
@arg12={{this.someSpecialOverrideTrackedProp}}
...
@arg46={{@arg46}}
/>
Here is the component.js where I’d like @arg12 to be provided as a dynamic input:
// MySubClassComponent/component.js
export default class MySubClassComponent extends BaseComponent {
constructor(owner, args) {
// What I would like to do here is provide an alternate dynamic argument
super(owner, {...args, arg12: mySpecialOverride });
}
}
1 post - 1 participant