diff --git a/apps/web/src/components/ui/toast.tsx b/apps/web/src/components/ui/toast.tsx index a8df9d0aca6aeb08bdec67e65c57befec3dd6fdc..7e75d0d0c4b8d8e34257b224529964a8f7341d33 100644 --- a/apps/web/src/components/ui/toast.tsx +++ b/apps/web/src/components/ui/toast.tsx @@ -2,7 +2,7 @@ import { Toast } from "@base-ui/react/toast"; import { useEffect } from "react"; -import { useRouterState } from "@tanstack/react-router"; +import { useParams } from "@tanstack/react-router"; import { CircleAlertIcon, CircleCheckIcon, @@ -56,17 +56,9 @@ function shouldRenderForActiveThread( } function useActiveThreadIdFromRoute(): string | null { - return useRouterState({ - select: (routerState) => { - for (let index = routerState.matches.length - 1; index >= 0; index -= 1) { - const params = routerState.matches[index]?.params as Record | undefined; - const threadId = params?.threadId; - if (typeof threadId === "string" && threadId.length > 0) { - return threadId; - } - } - return null; - }, + return useParams({ + strict: false, + select: (params) => params.threadId ?? null, }); }