fix(desktop): only the exact channel route keeps a live switch trace

Blind-review round 13 (Sonnet xhigh) hardening: leavesChannelSurface
used a /channels/ prefix check, so sibling routes (forum posts) counted
as staying on the channel surface and kept a live trace alive. No
currently reachable path turns that into a wrong record — every
re-entry overwrites or drops the trace — but the invariant from
9b462328d should hold structurally, not incidentally. Anything other
than the exact message-view route now drops the active trace.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
This commit is contained in:
Max Lampert
2026-08-25 01:30:43 -07:00
parent ad981ff07c
commit e0f4768ec7

View File

@@ -54,8 +54,10 @@ export function useAppNavigation() {
hasStateUpdate: next.state !== undefined,
// Leaving the channel surface must drop any active switch trace —
// including one whose channel screen never mounted (route still
// resolving), which no component cleanup can cover.
leavesChannelSurface: !next.to.startsWith("/channels/"),
// resolving), which no component cleanup can cover. Only the exact
// channel message-view route keeps a live trace: sibling routes
// (forum posts) mount different, untraced screens.
leavesChannelSurface: next.to !== "/channels/$channelId",
navigate: () =>
navigate({
...next,