# How to re-execute scripts in theme components

**URL:** <https://meta.discourse.org/t/how-to-re-execute-scripts-in-theme-components/191394>\
**Category:** Development\
**Created:** [May 23, 2021, 5:40pm UTC](https://meta.discourse.org/t/how-to-re-execute-scripts-in-theme-components/191394 "2021-05-23T17:40:12Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Marvelxy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marvelxy/32/218786_2.png) [@Marvelxy](https://meta.discourse.org/u/Marvelxy)\
**Post date:** [May 23, 2021, 9:38pm UTC](https://meta.discourse.org/t/how-to-re-execute-scripts-in-theme-components/191394/3 "2021-05-23T21:38:25Z")

</div>

Where would this if I’m building a theme component? This is my code at the moment. I’m trying to re-render the footer every time there’s a route change so that the scripts would re-execute.

I’m getting weird errors.

I’m a total beginner, and I don’t know if this is the right way to go about this.

```plaintext
    initialize() {
      withPluginApi("0.8", api => {
        if (settings.Show_footer_on_login_required_page) {
          api.modifyClass("controller:static", {
            @on("init")
            showFooterOnStatic() {
              this.set("application.showFooter", true);
            }
        });

        api.onPageChange(() => {
          showFooterOnStatic() {
            this.set("application.showFooter", true);
          }
        });
      }
    });

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-re-execute-scripts-in-theme-components/191394)._
