I’m trying to optionally replace a post small action description with a CustomComponent.
However, the post is not correctly passed to the value transformer.
@cached
get CustomComponent() {
return applyValueTransformer("post-small-action-custom-component", null, {
actionCode: this.code,
post: this.post,
});
}
My debugging code
api.registerValueTransformer(
"post-small-action-custom-component",
(arg) => {
console.log(arg);
}
);
Output:
context: Object { actionCode: "bid", post: undefined }
The test does not check the parameters, so this goes unnoticed.
I guess the post parameter should be this.args.post
and not this.post
.
I’ve been trying a workaround by unconditionally adding the component and having it check itself what to do but unfortunately it seems like the arguments are not being passed correctly either so both the workaround and a normal implementation fail here as well:
<this.CustomComponent
@code={{this.code}}
@post={{this.post}}
@createdAt={{this.createdAt}}
@path={{this.path}}
@username={{this.username}}
/>
There are getters in PostSmallAction
for code
, createdAt
and path
, but (again) this.post
does not exist and username()
seems to have a bug as well (there is no action_code_who
in this.args.post
?) , so those attributes stay empty.
I can’t find an existing “real world” implementation. Am I really the first one to use this ?