# Why are custom header links 'overridden'?

**URL:** https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359
**Category:** Bug
**Tags:** custom-header-links
**Created:** [January 29, 2024, 9:33pm UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359 "2024-01-29T21:33:31Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![spdegabrielle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/spdegabrielle/32/190784_2.png) [@spdegabrielle](https://meta.discourse.org/u/spdegabrielle)
#### Post date: [January 29, 2024, 9:33pm UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/1 "2024-01-29T21:33:31Z")

</div>

They appear to be working ok but the setting has a dot indicating they are overridden?

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/3/1/8317c2c7c6985b932f3a375504bd064f122e3daf.png)

Any idea what is going on here?

PS I did try searching for ‘custom header links’ but I can’t find a topic that mentions this problem

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [January 29, 2024, 9:50pm UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/2 "2024-01-29T21:50:08Z")

</div>

I think you changed that setting. So, you have overwritten the default, which is very likely since that is the purpose of this setting. The default is more like an example because you use the theme component to add _custom_ links. With the reset button, you could change the setting back to default.

---

<div class="post-metadata">

### Author: ![spdegabrielle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/spdegabrielle/32/190784_2.png) [@spdegabrielle](https://meta.discourse.org/u/spdegabrielle)
#### Post date: [January 29, 2024, 10:34pm UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/3 "2024-01-29T22:34:34Z")

</div>

It was very odd

When I first looked at my site it had new links(external,popular,privacy)- but my links were still in the fields.

I hit reset and lost my custom link config.

Fortunately I saved the text of each and added them back, removing the new links.

Oh well. Software is weird.

---

<div class="post-metadata">

### Author: ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)
#### Post date: [January 29, 2024, 10:37pm UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/4 "2024-01-29T22:37:34Z")

</div>

Also was puzzled about this.. Actually the settings variable name was changed, see [DEV: Rename `Custom_header_links` settings to `custom_header_links` (… · discourse/discourse-custom-header-links@5006125 · GitHub](https://github.com/discourse/discourse-custom-header-links/commit/50061254831a658eba821238a8a1ae0b7029ab09)

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [February 3, 2024, 7:58am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/5 "2024-02-03T07:58:46Z")

</div>

@tgxworld There is a bug in the latest update to the theme component. It renames the setting using a migration but at that point the [original setting name has already been renamed](https://github.com/discourse/discourse-custom-header-links/commit/50061254831a658eba821238a8a1ae0b7029ab09#diff-6167ce9ac9bedafca7114a29ba4fba1ad953b7e6006a3dff08e3272c1866128bR1) in `settings.yml`. So the migration won’t work since it cannot access the old setting anymore. These kind of migrations should be done in two separate steps (and, [given how theme component migrations work](https://github.com/discourse/discourse/pull/24071), with lots of time in between)

So everyone updating this theme component will lose their settings.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [February 3, 2024, 8:01am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/6 "2024-02-03T08:01:29Z")

</div>

FWIW I think if you re-save the setting rather than reset it then it all comes good

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [February 3, 2024, 8:02am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/7 "2024-02-03T08:02:52Z")

</div>

AFAIK that only works when updating the theme component separately in the GUI, not when the TC is updated as part of a bigger update (i.e. the rake task)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [February 3, 2024, 8:06am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/8 "2024-02-03T08:06:59Z")

</div>

I think it works if you update your whole site, notice the links are now the default, and then re-save the `custom header links` theme setting.

Though it is easy not to do that and press reset instead. 😢

---

<div class="post-metadata">

### Author: ![jericson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jericson/32/116215_2.png) [@jericson](https://meta.discourse.org/u/jericson)
#### Post date: [February 3, 2024, 7:52pm UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/9 "2024-02-03T19:52:40Z")

</div>

This worked for me. It took me a good moment to figure out what was going on since the setting _looked correct_. I fixed it by removing the theme component from my default theme (since it was actively making the site worse) and noticing it was now working using the other theme.

I’m glad the fix was so easy I fell into it, but it was a shock to find the links getting changed after updating Discourse. ☹

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [February 5, 2024, 2:36am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/10 "2024-02-05T02:36:13Z")

</div>

> [@RGJ](#):
>
> It renames the setting using a migration but at that point the [original setting name has already been renamed](https://github.com/discourse/discourse-custom-header-links/commit/50061254831a658eba821238a8a1ae0b7029ab09#diff-6167ce9ac9bedafca7114a29ba4fba1ad953b7e6006a3dff08e3272c1866128bR1) in `settings.yml`. So the migration won’t work since it cannot access the old setting anymore.

We [pull the overriden theme settings from the database which stores the key of the setting](https://github.com/discourse/discourse/blob/ac53e5a9622bd118fffa37684c5b0f894e97b943/app/services/theme_settings_migrations_runner.rb#L160-L164) so the content in the `settings.yml` does not affect the migrations at all. What I suspect here is that we are not clearing the cache?

> [@RGJ](#):
>
> These kind of migrations should be done in two separate steps (and, [given how theme component migrations work](https://github.com/discourse/discourse/pull/24071), with lots of time in between)

That is not how we intended the design to be. Since we have no control over how themes are updated, we cannot do a 2 step migration.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [February 5, 2024, 5:35am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/11 "2024-02-05T05:35:43Z")

</div>

So this was a recent regression with our migrations system where the cache for a theme is not updated after theme migrations are run. This has been fixed in

[https://github.com/discourse/discourse/pull/25562](https://github.com/discourse/discourse/pull/25562)

> [@RGJ](#):
>
> So everyone updating this theme component will lose their settings.

So this is not true because the settings are actually not lost but the cache is just using the setting’s default value instead of the overrides in the database.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [February 5, 2024, 7:13am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/12 "2024-02-05T07:13:36Z")

</div>

Thank you for the explanation and your quick actions.

---

<div class="post-metadata">

### Author: ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)
#### Post date: [February 7, 2024, 10:50am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/13 "2024-02-07T10:50:06Z")

</div>

Just having the same issue after updating the Easy Footer component. All custom settings are gone on the frontend and on the backend ui.

It’s causing quite some confusion for community managers. If they then push “Reset” on the backend, it takes quite some time to re-do all the settings, on the Footer component even more so than with the Header links.

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [February 7, 2024, 10:59am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/14 "2024-02-07T10:59:12Z")

</div>

Looks like we believed this was due to an issue in core which has been fixed as when [the above PR](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/11) was merged.

Do you know what version (commit) of Discourse they had running when you updated the theme component?

---

<div class="post-metadata">

### Author: ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)
#### Post date: [February 7, 2024, 11:01am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/15 "2024-02-07T11:01:36Z")

</div>

Yes, I was just about to edit my post.. this happened both on the latest stable branch, 3.2. I guess it should be fixed for stable as well though, otherwise all changes to component settings would need to be pinned to a higher version?

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [February 7, 2024, 11:11am UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/16 "2024-02-07T11:11:43Z")

</div>

Ah, yep. @tgxworld let’s think about which approach makes the most sense here for stable (backporting core fix or imposing some constraints on compatibility in components that use settings migrations).

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [February 7, 2024, 12:32pm UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/18 "2024-02-07T12:32:22Z")

</div>

> [@mcwumbly](#):
>
> backporting core fix

That was already done 2 days ago [FIX: Update themes javascript cache after running themes migrations (… · discourse/discourse@39dffcb · GitHub](https://github.com/discourse/discourse/commit/39dffcb657b8e0b11b3cc0c9a81d0b103814d78a)

@manuel what’s the commit hash of your install?

---

<div class="post-metadata">

### Author: ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)
#### Post date: [February 7, 2024, 1:01pm UTC](https://meta.discourse.org/t/why-are-custom-header-links-overridden/293359/19 "2024-02-07T13:01:29Z")

</div>

Oh yeah my bad, didn’t update this server! Sorry guys, it’s just on staging but had a client reach out why it’s all reset.
