# Theme component order of precedence

**URL:** <https://meta.discourse.org/t/theme-component-order-of-precedence/156615>\
**Category:** Development\
**Created:** [2 juli 2020 om 15:13 UTC](https://meta.discourse.org/t/theme-component-order-of-precedence/156615 "2020-07-02T15:13:16Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![guildai](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/guildai/32/248544_2.png) [@guildai](https://meta.discourse.org/u/guildai)\
**Post date:** [3 juli 2020 om 13:59 UTC](https://meta.discourse.org/t/theme-component-order-of-precedence/156615/3 "2020-07-03T13:59:48Z")

</div>

This is the code I’m running:

```plaintext
<script type="text/discourse-plugin" version="0.8">
    const { run } = Ember;
    
    api.decorateCooked($elem => {
        run.scheduleOnce("actions", () => {
          // Must run before the scheduled actions from TOC component.
        });
    })

```

The TOC component uses the same interface to [schedule its actions](https://github.com/discourse/DiscoTOC/blob/master/common/header.html#L254).

According to the Ember docs, the schedule interface:

> Adds the passed target/method and any optional arguments to the named queue to be executed at the end of the RunLoop

This term “add” suggests a FIFO ordering of scheduled actions. Therefore the order that the call to `schedule` is critical here.

---

_[View the full topic](https://meta.discourse.org/t/theme-component-order-of-precedence/156615)._
