# הערך מחדש ווידג'טים בכותרת בעת שינוי נתיב ללא שגיאה

**URL:** <https://meta.discourse.org/t/re-evaluate-widgets-in-header-upon-route-change-without-error/262697>\
**Category:** Development\
**Created:** [24 באפריל,‏ 2023,‏ 11:57am UTC](https://meta.discourse.org/t/re-evaluate-widgets-in-header-upon-route-change-without-error/262697 "2023-04-24T11:57:57Z")\
**Posts on this page:** 1\
**Showing post:** 1

<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:** [24 באפריל,‏ 2023,‏ 11:57am UTC](https://meta.discourse.org/t/re-evaluate-widgets-in-header-upon-route-change-without-error/262697/1 "2023-04-24T11:57:57Z")

</div>

I’m trying to override this widget template:

```plaintext
      api.reopenWidget("header-contents", {
        template: hbs`
          {{#if this.site.desktopView}}
            {{#if attrs.sidebarEnabled}}
              {{sidebar-toggle attrs=attrs}}
            {{/if}}
          {{/if}}

          {{home-logo attrs=attrs}}

          {{#if attrs.topic}}
            {{header-topic-info attrs=attrs}}
          {{else if this.siteSettings.bootstrap_mode_enabled}}
            {{#if transformed.showBootstrapMode}}
              {{header-bootstrap-mode attrs=attrs}}
            {{/if}}
          {{/if}}

          <div class="panel clearfix" role="navigation">{{yield}}</div>
        `,
      });

```

Despite the template being currently _identical_ to the original in [discourse/app/assets/javascripts/discourse/app/widgets/header-contents.js at 4aa81e709ea49e30383a3a3acd33dfedaebfc240 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/4aa81e709ea49e30383a3a3acd33dfedaebfc240/app/assets/javascripts/discourse/app/widgets/header-contents.js#L1)

It is generating an error:

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/6/9/c6961cd15c1365c93b9cc3093c8faf7241488213.png)

This is unexpected, especially since I’m not actually “changing anything” (yet)?

I’m able to reproduce this problem even if this is the _only_ modification.

Ultimately the reason I’m trying to change this is so that I can force a re-evaluation of this template even if I’m not moving in or out of a topic route.

Ultimately I want to add logic so that the widget is forced to refresh when moving in and out of category routes because my Category route presentation needs to be different.

So one solution to this might be another way to force the header contents to be refreshed.

In any case, this doesn’t seem to be behaving as I should expect?

---

_[View the full topic](https://meta.discourse.org/t/re-evaluate-widgets-in-header-upon-route-change-without-error/262697)._
