Fix sidebar highlighting for draft threads (#4679)
This commit is contained in:
1 parent
6afbed3c36
commit
6a3df51707
1 file changed
+12
-2
@@ -96,7 +96,11 @@ import { threadEnvironment } from "../state/threads";
|
||||
import { projectEnvironment } from "../state/projects";
|
||||
import { useEnvironmentQuery } from "../state/query";
|
||||
import { useAtomCommand } from "../state/use-atom-command";
|
||||
import { buildThreadRouteParams, resolveThreadRouteTarget } from "../threadRoutes";
|
||||
import {
|
||||
buildThreadRouteParams,
|
||||
resolveActiveThreadRouteRef,
|
||||
resolveThreadRouteTarget,
|
||||
} from "../threadRoutes";
|
||||
import { formatRelativeTimeLabel, parseTimestampDate } from "../timestampFormat";
|
||||
import type { SidebarThreadSummary } from "../types";
|
||||
import { cn } from "~/lib/utils";
|
||||
@@ -1052,7 +1056,13 @@ export default function SidebarV2() {
|
||||
strict: false,
|
||||
select: (params) => resolveThreadRouteTarget(params),
|
||||
});
|
||||
const routeThreadRef = routeTarget?.kind === "server" ? routeTarget.threadRef : null;
|
||||
const routeDraftThread = useComposerDraftStore((store) =>
|
||||
routeTarget?.kind === "draft" ? store.getDraftSession(routeTarget.draftId) : null,
|
||||
);
|
||||
const routeThreadRef = useMemo(
|
||||
() => resolveActiveThreadRouteRef(routeTarget, routeDraftThread),
|
||||
[routeDraftThread, routeTarget],
|
||||
);
|
||||
const routeThreadKey = routeThreadRef ? scopedThreadKey(routeThreadRef) : null;
|
||||
const routeTargetRef = useRef(routeTarget);
|
||||
routeTargetRef.current = routeTarget;
|
||||
|
||||
Reference in new issue
Block a user