# Topic title duplicated in header

**URL:** https://meta.discourse.org/t/topic-title-duplicated-in-header/58599
**Category:** Bug
**Created:** [March 7, 2017, 11:24pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599 "2017-03-07T23:24:27Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [March 7, 2017, 11:24pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/1 "2017-03-07T23:24:27Z")

</div>

I’ve started noticing this about a week or so ago. I’ve yet to get a consistent repro - but it seems to occur after editing a topic (as TL3 here on Meta, or Moderator at [Stonehearth](https://discourse.stonehearth.net)).

Here’s what I’ve been seeing:

 ![](https://global.discourse-cdn.com/meta/original/3X/9/0/902807c094cedd9c4e6b80bfa8a67f897a55a232.png)

On a topic that can scroll, moving down (go to a later post) then back up resolves it. On a topic without scroll, I have to refresh the page to resolve it.

Has anyone else seen this?

Edit: just made a ninja edit to fix a typo, got the bug in this very topic!

 ![](https://global.discourse-cdn.com/meta/original/3X/3/f/3f1dd98aa642dae34fe0045a646e670ccf084133.png)

Edit 2: And it happened again after the edit to add the image. Perhaps repro is being scrolled to topic of topic when making an edit…

---

<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: [March 7, 2017, 11:42pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/2 "2017-03-07T23:42:26Z")

</div>

What is the exact repro? I am not clear.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [March 7, 2017, 11:45pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/3 "2017-03-07T23:45:11Z")

</div>

I’m still not sure this is 100% reproducible - haven’t had time to attempt repro in my dev instance.

Here’s what I _think_ is the repro:

1. Create a topic (or have permissions to edit topics).
2. Open the topic editor.
3. Scroll the topic view behind the editor to the very top.
4. Make and edit and save.
5. See the “duplciated” title

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [March 8, 2017, 4:17pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/4 "2017-03-08T16:17:05Z")

</div>

I just tried this on my dev setup.

1. Open existing topic
2. Click the pencil to edit the original post.
3. Scroll down to bottom of topic.
4. Scroll up to top of the topic.
5. Save edit.
6. See double title

---

<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: [March 8, 2017, 5:50pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/5 "2017-03-08T17:50:52Z")

</div>

@eviltrout can you have a look at this?

---

<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: [March 10, 2017, 10:10pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/7 "2017-03-10T22:10:21Z")

</div>

Another simple repro on local

- Open 2 tabs looking at same topic, be scrolled to top.
- Edit title in one tab
- Go to second tab and header re-rendered with this bug

So messagebus is telling page to re-render header (correctly) but the check of what state it should be is somehow omitted.

---

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [March 15, 2017, 9:50am UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/8 "2017-03-15T09:50:06Z")

</div>

An easy reproduction is here:

> **[Ionuț Staicu](https://ionutstaicu.com/)**

_(opened another [thread](https://meta.discourse.org/t/logo-is-replaced-when-a-topic-is-edited/59143/) because i didnt knew about this one)_

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [March 16, 2017, 12:30pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/9 "2017-03-16T12:30:58Z")

</div>

Hello,

I just fixed this and submitted a pull request.

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

EDIT: To explain a little bit how I tracked the bug:

1. I tried reproducing and found out that it actually reproduces by changing a topic’s title.
2. I found out that there are two events that control the header and if the topic title is shown or not: `header:show-topic` and `header:hide-topic`.
3. Searched where `header:show-topic` is triggered and found a match when a topic is reloaded (which happens when a topic is edited).
4. I changed the code to trigger `header:show-topic` only if the the topic title is not visible (not the one from the header, but the proper one, `#topic-title`).

---

<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: [March 20, 2017, 4:37pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/10 "2017-03-20T16:37:45Z")

</div>

Thanks, looks like @sam merged it recently 🙂

---

<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: [March 20, 2017, 4:37pm UTC](https://meta.discourse.org/t/topic-title-duplicated-in-header/58599/11 "2017-03-20T16:37:50Z")

</div>


