# Ao voltar de um tópico, a contagem de não lidos é exibida mesmo sem rastrear o tópico

**URL:** <https://meta.discourse.org/t/hitting-the-back-button-from-a-topic-shows-the-unread-count-even-when-not-tracking-topic/232276>\
**Category:** Bug\
**Created:** [Julho 8, 2022, 2:15am UTC](https://meta.discourse.org/t/hitting-the-back-button-from-a-topic-shows-the-unread-count-even-when-not-tracking-topic/232276 "2022-07-08T02:15:38Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [Julho 14, 2022, 8:59am UTC](https://meta.discourse.org/t/hitting-the-back-button-from-a-topic-shows-the-unread-count-even-when-not-tracking-topic/232276/5 "2022-07-14T08:59:56Z")

</div>

Isso não está relacionado ao estado de rastreamento de tópicos porque o estado de rastreamento de tópicos lida com a contagem de tópicos não lidos/novos, mas não com o número de contagens não lidas dentro de um tópico. Eu investiguei um pouco e isso é causado por

> <https://github.com/discourse/discourse/pull/15772>
>
> Instead of relaying on /timings request, we should cache last read post number. …That should protect from having incorrect unread counter when going back to topic list.
> 
> This additional cache is very temporary as once /timings request is finished, serializer will have a correct result.
> 
> Simplified flow is:
> 1. Store in cache information about last seen post number before /timings request is sent
> 2. When getting back to topic list compare value of last seen post number returned by /latest request and information in cache. If cache number is higher, than use it instead of information returned by /latest. In addition delete cache item as there is high chance that \`/timings\` request already finished.
> 3. Optionally, delete cache when timings request is done and topic list was not yet visited.
> 
> Keeping cache reasonably small should not affect performance.

Basicamente, as contagens de posts não lidos para um tópico só devem ser definidas quando o nível de notificação do usuário de um determinado tópico for de rastreamento ou superior, o que o código atual adicionado pelo PR não considerou.

 ![Screenshot from 2022-07-14 16-59-21](https://global.discourse-cdn.com/meta/original/4X/0/7/3/0730d360104268a27048c64b20442aed0386ef14.png)

Eu tenho uma correção inicial, mas preciso escrever testes para ela antes de enviar um PR.

---

_[View the full topic](https://meta.discourse.org/t/hitting-the-back-button-from-a-topic-shows-the-unread-count-even-when-not-tracking-topic/232276)._
