# Editing topic title/category or tag does not re-render docked header

**URL:** <https://meta.discourse.org/t/editing-topic-title-category-or-tag-does-not-re-render-docked-header/54468>\
**Category:** Bug\
**Created:** [December 19, 2016, 3:31am UTC](https://meta.discourse.org/t/editing-topic-title-category-or-tag-does-not-re-render-docked-header/54468 "2016-12-19T03:31:39Z")\
**Posts on this page:** 4\
**Page:** 1

## AI-generated summary

A discussion is taking place about the best approach to fix an issue where editing a topic's title, category, or tag does not update the docked header. [sam](/t/-/54468/1) proposes two possible solutions: having the header widget observe the category for changes or having the controller tell the widget to re-render when the first post is edited. However, [codinghorror](/t/-/54468/2) advises against using observers, and [eviltrout](/t/-/54468/3) suggests using the injected `appEvents` object to signal changes, specifically triggering the `header:show-topic` event after the topic is updated, which was implemented in a [commit](https://github.com/discourse/discourse/commit/05e99a68cec550eb3b1aa9703bdca462e74303e7).

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [December 19, 2016, 3:31am UTC](https://meta.discourse.org/t/editing-topic-title-category-or-tag-does-not-re-render-docked-header/54468/1 "2016-12-19T03:31:39Z")

</div>

@eviltrout I want to fix this but not sure about what the right way is to route the event.

Repro:

- Edit first post
- Scroll down so title,category and tags are now in the header
- Edit category, tags or title
- Edit is not reflected in `header-topic-info` widget cause a reload of topic is not reflected

I can think of some hacks to fix this but not sure what the correct approach is:

- Option 1: have the header widget `observe` the category for relevant changes and rerender self. (downside, more observers and need to be careful about unobserving)

- Option 2: have the controller tell the widget to re-render when first post is edited unconditionally. (downside, no clear API for how to seek out the widget and rerender)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [December 19, 2016, 6:26am UTC](https://meta.discourse.org/t/editing-topic-title-category-or-tag-does-not-re-render-docked-header/54468/2 "2016-12-19T06:26:56Z")

</div>

I vote for not observing, that is a path of suffering.

---

<div class="post-metadata">

**Author:** ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)\
**Post date:** [December 19, 2016, 5:29pm UTC](https://meta.discourse.org/t/editing-topic-title-category-or-tag-does-not-re-render-docked-header/54468/3 "2016-12-19T17:29:14Z")

</div>

In cases where components don’t exist in a hierarchy (for example, header and main body) I prefer to use our injected `appEvents` object to signal things like this. In fact, there is already a `header:show-topic` event that is triggered when the topic is changed while browsing around. So the fix was just to trigger that after the topic was updated:

[https://github.com/discourse/discourse/commit/05e99a68cec550eb3b1aa9703bdca462e74303e7](https://github.com/discourse/discourse/commit/05e99a68cec550eb3b1aa9703bdca462e74303e7)

Over time I learned to loathe observers. They still have some uses in our codebase but if there’s a way I can instead say “okay, signal that something changed”, preferably by action handler, I’ll always do that.

---

<div class="post-metadata">

**Author:** ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)\
**Post date:** [December 19, 2016, 5:29pm UTC](https://meta.discourse.org/t/editing-topic-title-category-or-tag-does-not-re-render-docked-header/54468/4 "2016-12-19T17:29:21Z")

</div>


