From e0f4768ec72aefbac65f6bcfd77051a371a362f0 Mon Sep 17 00:00:00 2001 From: Max Lampert Date: Tue, 25 Aug 2026 01:30:43 -0700 Subject: [PATCH] fix(desktop): only the exact channel route keeps a live switch trace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Max Lampert --- desktop/src/app/navigation/useAppNavigation.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/desktop/src/app/navigation/useAppNavigation.ts b/desktop/src/app/navigation/useAppNavigation.ts index 03b9b1aaf3..822621b5aa 100644 --- a/desktop/src/app/navigation/useAppNavigation.ts +++ b/desktop/src/app/navigation/useAppNavigation.ts @@ -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,