Render a component within a Widget. (Using select-kit components within plugin code)

Yeah, I have those defined. I’ll tidy and push to a repo.

A test demonstrating a form of two way binding with an embedded Component would be extremely helpful! :pray:

1 Like

I was able to access that, and the scheduleRerender() function. Updated tests and docs in

Just confirming - your @bind is imported from discourse-common/utils/decorators?

1 Like

Confirmed

Here’s the repo: GitHub - paviliondev/layouts-tag-intersection-widget: A small widget to allow you to navigate to a topic list based on a combinations of tags

And the widget file specifically: layouts-tag-intersection-widget/layouts-tag-combo.js.es6 at master · paviliondev/layouts-tag-intersection-widget (github.com)

Very much WIP and non-working as stated.

(Requires Layouts plugin installed and configured to test as is, but trivial to extract the widget code)

Ah, I think this might help:

- @onChange={{action @data.onChangeUpdateTagSet}}/>
+ @onChange=@data.onChangeUpdateTagSet/> 

When passing a ‘closure action’, there is no need for the (action helper (and in this case, I guess it actually breaks things)

2 Likes

That appears to result in TypeError: this.attrs.onChange is not a function?

But yeah, maybe that helper is masking the available attributes?

Oh my bad, we need some curlys there, otherwise it’s just parsed as a string attribute.

- @onChange={{action @data.onChangeUpdateTagSet}}/>
+ @onChange={{@data.onChangeUpdateTagSet}} /> 
1 Like

Unfortunately that results in the same error?

1 Like

Can you add a breakpoint and find out what the value of this.attrs.onChange is? (The “pause in exception” feature in the dev tools may help here)

1 Like

@David and I have resolved this over PM:

Thanks so much for your time @David.

I’ll publish the TC once complete.

3 Likes

This is now a thing, albeit slightly roughly finished atm:

image

Requires the Layouts Plugin.

Repo of Theme Component here: GitHub - paviliondev/layouts-tag-intersection-widget: A small widget to allow you to navigate to a topic list based on a combinations of tags

6 Likes

FYI this component supports Right Sidebar Blocks now too!

1 Like

FYI This component supports Discourse Bars 🍻 🍸

2 Likes