Unified · Split
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | import { Toast } from "@base-ui/react/toast"; |
| 4 | 4 | import { useEffect } from "react"; |
| 5 | −import { useRouterState } from "@tanstack/react-router"; | |
| 5 | +import { useParams } from "@tanstack/react-router"; | |
| 6 | 6 | import { |
| 7 | 7 | CircleAlertIcon, |
| 8 | 8 | CircleCheckIcon, |
| @@ -56,17 +56,9 @@ function shouldRenderForActiveThread( · 47 unmodified lines | ||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | function useActiveThreadIdFromRoute(): string | null { |
| 59 | − return useRouterState({ | |
| 60 | − select: (routerState) => { | |
| 61 | − for (let index = routerState.matches.length - 1; index >= 0; index -= 1) { | |
| 62 | − const params = routerState.matches[index]?.params as Record<string, unknown> | undefined; | |
| 63 | − const threadId = params?.threadId; | |
| 64 | − if (typeof threadId === "string" && threadId.length > 0) { | |
| 65 | − return threadId; | |
| 66 | − } | |
| 67 | − } | |
| 68 | − return null; | |
| 69 | − }, | |
| 59 | + return useParams({ | |
| 60 | + strict: false, | |
| 61 | + select: (params) => params.threadId ?? null, | |
| 70 | 62 | }); |
| 71 | 63 | } |
| 72 | 64 | |