@@ -68,7 +68,7 @@ import {
6868 squashAtomCommandFailure ,
6969} from "@t3tools/client-runtime/state/runtime" ;
7070import { threadRuntimeCanArchive } from "@t3tools/client-runtime/state/models" ;
71- import { useNavigate , useParams , useRouter } from "@tanstack/react-router" ;
71+ import { useNavigate , useRouter } from "@tanstack/react-router" ;
7272import {
7373 MAX_SIDEBAR_THREAD_PREVIEW_COUNT ,
7474 MIN_SIDEBAR_THREAD_PREVIEW_COUNT ,
@@ -129,11 +129,7 @@ import { useThreadActions } from "../hooks/useThreadActions";
129129import { projectEnvironment } from "../state/projects" ;
130130import { threadEnvironment , useEnvironmentThread } from "../state/threads" ;
131131import { useEnvironment , useEnvironments , usePrimaryEnvironmentId } from "../state/environments" ;
132- import {
133- buildThreadRouteParams ,
134- resolveActiveThreadRouteRef ,
135- resolveThreadRouteTarget ,
136- } from "../threadRoutes" ;
132+ import { buildThreadRouteParams , resolveActiveThreadRouteRef } from "../threadRoutes" ;
137133import { stackedThreadToast , toastManager } from "./ui/toast" ;
138134import { formatRelativeTimeLabel } from "../timestampFormat" ;
139135import { Kbd } from "./ui/kbd" ;
@@ -225,6 +221,7 @@ import {
225221 type SidebarProjectSnapshot ,
226222} from "../sidebarProjectGrouping" ;
227223import { PullRequestGlyph } from "~/components/pullRequest/pullRequestIcons" ;
224+ import { useThreadRouteTarget } from "../hooks/useThreadRouteTarget" ;
228225const SIDEBAR_SORT_LABELS : Record < SidebarProjectSortOrder , string > = {
229226 updated_at : "Last user message" ,
230227 created_at : "Created at" ,
@@ -3253,10 +3250,7 @@ export default function LegacySidebar() {
32533250 const handleNewThread = useNewThreadHandler ( ) ;
32543251 const { archiveThread, deleteThread, markThreadUnread } = useThreadActions ( ) ;
32553252 const { isMobile, setOpenMobile } = useSidebar ( ) ;
3256- const routeTarget = useParams ( {
3257- strict : false ,
3258- select : ( params ) => resolveThreadRouteTarget ( params ) ,
3259- } ) ;
3253+ const routeTarget = useThreadRouteTarget ( ) ;
32603254 const routeDraftThread = useComposerDraftStore ( ( store ) =>
32613255 routeTarget ?. kind === "draft" ? store . getDraftSession ( routeTarget . draftId ) : null ,
32623256 ) ;
0 commit comments