| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | | 2 | |
| 3 | import { Toast } from "@base-ui/react/toast"; | 3 | import { Toast } from "@base-ui/react/toast"; |
| 4 | import { useEffect } from "react"; | 4 | import { useEffect } from "react"; |
| 5 | import { useRouterState } from "@tanstack/react-router"; | 5 | import { useParams } from "@tanstack/react-router"; |
| 6 | import { | 6 | import { |
| 7 | CircleAlertIcon, | 7 | CircleAlertIcon, |
| 8 | CircleCheckIcon, | 8 | CircleCheckIcon, |
| ... | @@ -56,17 +56,9 @@ function shouldRenderForActiveThread( | ... | @@ -56,17 +56,9 @@ function shouldRenderForActiveThread( |
| 56 | } | 56 | } |
| 57 | | 57 | |
| 58 | function useActiveThreadIdFromRoute(): string | null { | 58 | function useActiveThreadIdFromRoute(): string | null { |
| 59 | return useRouterState({ | 59 | return useParams({ |
| 60 | select: (routerState) => { | 60 | strict: false, |
| 61 | for (let index = routerState.matches.length - 1; index >= 0; index -= 1) { | 61 | select: (params) => params.threadId ?? null, |
| 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 | }, | | |
| 70 | }); | 62 | }); |
| 71 | } | 63 | } |
| 72 | | 64 | |