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

**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:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shauny](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shauny/32/362012_2.png) [@Shauny](https://meta.discourse.org/u/Shauny)\
**Post date:** [2026年五月20日 13:16 UTC](https://meta.discourse.org/t/back-button-on-chat-forgets-if-its-a-starred-chat/403431/1 "2026-05-20T13:16:46Z")

</div>

这是一个每天让我都很烦恼的 bug，希望它能被修复。

现在我们可以[将喜欢的聊天频道设为星标](https://meta.discourse.org/t/star-your-favorite-chat-channels-for-easy-access/390713)了，我也已经为一些频道和我私聊的对象设置了星标。

1. 无法将“星标”设为打开聊天时默认显示的标签页。
2. 关闭聊天窗口后点击“返回”时，总是回到“频道”或“私信”标签页，即使你之前所在的聊天是已标星的。它应该返回到“星标”标签页。

这意味着你每次都需要额外点击一次“星标”，这在一定程度上违背了它作为省时工具的初衷。

---

<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:** [2026年五月21日 05:01 UTC](https://meta.discourse.org/t/back-button-on-chat-forgets-if-its-a-starred-chat/403431/2 "2026-05-21T05:01:01Z")

</div>

@Shauny 只是确认一下，这一切都是关于「浮动聊天」窗口的，没有任何部分会全屏显示。

我觉得这里 @lindsey 的根本问题在于，我们允许浮动模式下的聊天参与网页历史记录。我认为，如果处于浮动模式，它应该让出空间……我们可以记住它上次打开时的位置，但在浮动模式下切换 URL 会造成很多困惑。

---

<div class="post-metadata">

**Author:** ![Shauny](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shauny/32/362012_2.png) [@Shauny](https://meta.discourse.org/u/Shauny)\
**Post date:** [2026年五月21日 05:54 UTC](https://meta.discourse.org/t/back-button-on-chat-forgets-if-its-a-starred-chat/403431/3 "2026-05-21T05:54:22Z")

</div>

是的，没错！浮动模式。

---

<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

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2026年八月13日 16:28 UTC](https://meta.discourse.org/t/back-button-on-chat-forgets-if-its-a-starred-chat/403431/5 "2026-08-13T16:28:55Z")

</div>


