| ... | ... | @@ -96,7 +96,11 @@ import { threadEnvironment } from "../state/threads"; |
| 96 | 96 | import { projectEnvironment } from "../state/projects"; |
| 97 | 97 | import { useEnvironmentQuery } from "../state/query"; |
| 98 | 98 | import { useAtomCommand } from "../state/use-atom-command"; |
| 99 | | import { buildThreadRouteParams, resolveThreadRouteTarget } from "../threadRoutes"; |
| 99 | import { |
| 100 | buildThreadRouteParams, |
| 101 | resolveActiveThreadRouteRef, |
| 102 | resolveThreadRouteTarget, |
| 103 | } from "../threadRoutes"; |
| 100 | 104 | import { formatRelativeTimeLabel, parseTimestampDate } from "../timestampFormat"; |
| 101 | 105 | import type { SidebarThreadSummary } from "../types"; |
| 102 | 106 | import { cn } from "~/lib/utils"; |
| ... | ... | @@ -1052,7 +1056,13 @@ export default function SidebarV2() { |
| 1052 | 1056 | strict: false, |
| 1053 | 1057 | select: (params) => resolveThreadRouteTarget(params), |
| 1054 | 1058 | }); |
| 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 | ); |
| 1056 | 1066 | const routeThreadKey = routeThreadRef ? scopedThreadKey(routeThreadRef) : null; |
| 1057 | 1067 | const routeTargetRef = useRef(routeTarget); |
| 1058 | 1068 | routeTargetRef.current = routeTarget; |