Repository navigation
Sidebar drops the current thread's highlight and shows its draft indicator while Settings or Usage is open #28692
Description
What happened
When I open the Settings or Usage modal from a thread, the sidebar stops highlighting the thread I'm on. It re-highlights only after I close the modal; it should stay highlighted the whole time.
While the modal is open, that thread also shows the yellow unsent-draft (compose) indicator, which normally only appears when a different thread is selected. It disappears again when the modal closes.
Diagnosis
Settings (/settings/*) and Usage (/usage) are routes rendered as modals over the thread that opened them. ChatRouteLayout handles this: while a modal route is matched it keeps rendering backgroundTarget, the last thread target (_chat.tsx#L21-L30).
The sidebar does not. It derives the current thread straight from route params via useThreadRouteTarget() (Sidebar.tsx#L993, #L1056-L1057). On a modal route there are no thread params, so routeThreadKey and routeRowThreadKey are null, and every row gets isActive/isRouteActive = false and isRouteThread = false (Sidebar.tsx#L3209, #L3334-L3338).
That causes both symptoms:
- The row loses its active background.
- The draft indicator is hidden only for the route thread (
useThreadHasUnsentDraft(threadRef) && !props.isRouteThread, SidebarThreadRow.tsx#L675), so the open thread's own draft surfaces as an indicator.
Likely fix: have the sidebar use the same background-target logic as ChatRouteLayout while isAppModalPage matches (for example, lift backgroundTarget into shared state). Draft routes (/draft/$draftId) probably need the same treatment for routeDraftId.
Introduced with #24847 (Settings and Usage open as large modals over your thread). The code is unchanged on main as of 2026-11-01.
Steps to reproduce
- Open any thread. Its sidebar row is highlighted.
- Type something in the composer without sending, so the thread has an unsent draft.
- Open Settings or Usage.
- Observe: the thread's sidebar row loses its highlight, and the yellow draft indicator appears on it.
- Close the modal (Esc, X, or backdrop).
- Observe: the highlight returns and the indicator disappears.
Reproduces every time, in any thread.
Version
0.1.6 (T3 Code Desktop, local server 0.1.6)
Environment
Windows 11 x64 (10.0.22621), Node 24.22.1, T3 Code Desktop app against its local server
Evidence
UI-only bug; nothing in the logs. Source references are in Diagnosis.
apps/web/src/routes/_chat.tsx (chat view keeps the thread while a modal is open):
const [backgroundTarget, setBackgroundTarget] = useState(threadTarget);
const shownTarget = modalOpen ? backgroundTarget : threadTarget;
apps/web/src/components/Sidebar.tsx (sidebar uses raw route params):
const routeTarget = useThreadRouteTarget();
const routeThreadRef = resolveActiveThreadRouteRef(routeTarget, routeDraftThread);Related issues
No duplicates found. Related: #24847 (introduced the modal routes). Separate issue filed for the modals' missing fade-in.
Fix applied or workaround
None needed; cosmetic. Nothing was changed on the machine.
Filed by
Claude Code (claude-opus-5-5) via T3 Code triage
Activity