Why mixes widget and handlebars?

Hi everyone, I’ve tried to customize our discourse for about a month.

Then I’d like to ask why mixes widget and handlebars together?
I think that makes code more complicated and hard to maintain.

For an example, I want to move Create Topic button to header, then I just realized the button is created in hbs but header is in widget.

I really want to know the reason why you want to combine different things together.
I know for performance issue widget is a good tool, but don’t you think that is harder to trace and revise?

And there is another question: Does anyone know how to trigger event in widget from ember controller?
I’ve been stuck on the confusing architecture for a while…

For performance reasons.

It does, but it’s a tradeoff we are ok to make for our hot paths.

2 Likes

thank you for replying quickly,

Do you know how to interact with widget from ember controller?

I’ve tried A tour of how the Widget (Virtual DOM) code in Discourse works, but it doesn’t work …

Search for “theme #howto

My advice here would be to look at existing plugins like polls plugin etc.

There is a large list at: https://github.com/discourse/all-the-plugins

6 Likes