# Topic-timeline api.decorateWidget call has stopped working

**URL:** https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573
**Category:** Development
**Created:** [April 13, 2023, 11:30am UTC](https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573 "2023-04-13T11:30:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [April 13, 2023, 11:30am UTC](https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573/1 "2023-04-13T11:30:45Z")

</div>

Hey friends!

I can’t pinpoint exactly when, but somewhere this year the following code has stopped working. It’s not throwing any errors, just doesn’t do anything anymore - I suspect this might be related to [this change](https://github.com/discourse/discourse/blob/6ccc0227f3826c279201d2a9673e27c77248bc76/app/assets/javascripts/discourse/app/components/topic-timeline/scroller.js), but I’m not sure.

```js
var bHTML = (some html);

api.decorateWidget('topic-timeline-container:before', helper => {
    return helper.h('div.side-block', [
    	helper.rawHtml(bHTML),
    ]);
});

```

Any ideas how I can fix this?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [April 13, 2023, 12:07pm UTC](https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573/2 "2023-04-13T12:07:43Z")

</div>

The timeline has been updated to use regular Ember/Glimmer components rather than our custom ‘widget’ system, so I’m afraid `decorateWidget` won’t work there any more.

Instead, you’ll need to use a [Plugin Outlet](https://meta.discourse.org/t/using-plugin-outlet-connectors-from-a-theme-or-plugin/32727). Right now we have these two:

> <https://github.com/discourse/discourse/blob/fa5a423681f528b90c22a0e661e229720337f0fb/app/assets/javascripts/discourse/app/components/topic-timeline/container.hbs#L39-L42>

> <https://github.com/discourse/discourse/blob/fa5a423681f528b90c22a0e661e229720337f0fb/app/assets/javascripts/discourse/app/components/topic-timeline/container.hbs#L172-L175>

But if they don’t work for your use case please let us know and we’re happy to look at introducing new ones.

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [April 19, 2023, 8:35am UTC](https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573/3 "2023-04-19T08:35:10Z")

</div>

I sorta got this to work, but I couldn’t find a way to insert any data from within a Theme Component. Is that still only possible from theme JS?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [April 19, 2023, 8:43am UTC](https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573/4 "2023-04-19T08:43:15Z")

</div>

> [@bartv](#):
>
> couldn’t find a way to insert any data from within a Theme Component. Is that still only possible from theme JS?

What do you mean by insert data?

There should be no difference between TC JS and a Theme.

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [May 1, 2023, 6:29am UTC](https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573/5 "2023-05-01T06:29:12Z")

</div>

I spoke too soon and I need some more help with this. I added the following code in the HEAD section of a Theme Component:

```plaintext
<script type='text/x-handlebars' data-template-name='/connectors/timeline-controls-before/adnet'>
    <div class="side-block">
        <div id="supporters"></div>
    </div>
</script>

```

While this renders for me, the admin, it doesn’t display for regular users. Any idea why?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [May 2, 2023, 8:56am UTC](https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573/6 "2023-05-02T08:56:41Z")

</div>

Looks like that outlet is only rendered when the ‘timeline controls’ are visible

> <https://github.com/discourse/discourse/blob/a1b35601fcd209d83471e269e23b7c4f9a42465a/app/assets/javascripts/discourse/app/components/topic-timeline/container.hbs#L37-L42>

Perhaps we should introduce another outlet before that `{{#if`. What do you think @isaac @featheredtoast

---

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [May 19, 2023, 8:08pm UTC](https://meta.discourse.org/t/topic-timeline-api-decoratewidget-call-has-stopped-working/261573/9 "2023-05-19T20:08:40Z")

</div>

Can confirm, this would be nice available outside `{{#if` 👍🏻
