authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-07-27 22:48:45+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-07-27 22:48:45+02:00
log6a3df51707b67c3435f86b3b83a093aec8b03415
treedaade286c688bbe5ea743bb6bbc2409a144776be
parent6afbed3c36bbb731b9551ec60d7d12ed1fd1d2ee
signature Signed by PGP key B5690EEEBB952194

Fix sidebar highlighting for draft threads (#4679)


1 files changed, 12 insertions(+), 2 deletions(-)

apps/web/src/components/SidebarV2.tsx+12-2
......@@ -96,7 +96,11 @@ import { threadEnvironment } from "../state/threads";
9696import { projectEnvironment } from "../state/projects";
9797import { useEnvironmentQuery } from "../state/query";
9898import { useAtomCommand } from "../state/use-atom-command";
99import { buildThreadRouteParams, resolveThreadRouteTarget } from "../threadRoutes";
99import {
100 buildThreadRouteParams,
101 resolveActiveThreadRouteRef,
102 resolveThreadRouteTarget,
103} from "../threadRoutes";
100104import { formatRelativeTimeLabel, parseTimestampDate } from "../timestampFormat";
101105import type { SidebarThreadSummary } from "../types";
102106import { cn } from "~/lib/utils";
......@@ -1052,7 +1056,13 @@ export default function SidebarV2() {
10521056 strict: false,
10531057 select: (params) => resolveThreadRouteTarget(params),
10541058 });
1055 const routeThreadRef = routeTarget?.kind === "server" ? routeTarget.threadRef : null;
1059 const routeDraftThread = useComposerDraftStore((store) =>
1060 routeTarget?.kind === "draft" ? store.getDraftSession(routeTarget.draftId) : null,
1061 );
1062 const routeThreadRef = useMemo(
1063 () => resolveActiveThreadRouteRef(routeTarget, routeDraftThread),
1064 [routeDraftThread, routeTarget],
1065 );
10561066 const routeThreadKey = routeThreadRef ? scopedThreadKey(routeThreadRef) : null;
10571067 const routeTargetRef = useRef(routeTarget);
10581068 routeTargetRef.current = routeTarget;