# 聊天返回按钮会忘记该聊天是否已加星标

**URL:** https://meta.discourse.org/t/back-button-on-chat-forgets-if-its-a-starred-chat/403431
**Category:** Bug
**Tags:** chat, fixed
**Created:** [2026年五月20日 13:16 UTC](https://meta.discourse.org/t/back-button-on-chat-forgets-if-its-a-starred-chat/403431 "2026-05-20T13:16:46Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2026年五月21日 11:25 UTC](https://meta.discourse.org/t/back-button-on-chat-forgets-if-its-a-starred-chat/403431/4 "2026-05-21T11:25:11Z")

</div>

合并后应该会好一些

> <https://github.com/discourse/discourse/pull/40219>
>
> When the chat drawer is closed and reopened on a starred channel, the back butto…n took the user to the default channels list instead of the starred-channels list they had originally come from.
> 
> Root cause: \`chatHistory.visit(route)\` always appended to history. When the drawer reopens to \`lastKnownChatURL\` (the channel itself), the same route is appended a second time, shifting \`previousRoute\` off the original \`chat.starred-channels\` entry. The back-button fallback in \`drawer-routes/channel.gjs\` then routed to \`chat.channels\`.
> 
> Fix: dedupe consecutive identical route visits in \`chatHistory.visit\` by comparing name and params (via \`deepEqual\`). Reopening to the same URL no longer clobbers the user's real navigation context.
> 
> Adds a unit test for the dedup behavior, a system spec covering the close/reopen scenario, and a view-agnostic \`open\_channel\_row\` helper on the drawer page object (the existing \`open\_channel\` is scoped to the channels-list view only and doesn't work from the starred view).
> 
> https://meta.discourse.org/t/403431

---

_[View the full topic](https://meta.discourse.org/t/back-button-on-chat-forgets-if-its-a-starred-chat/403431)._
