History

simp

Julius Marminge committed 8 months ago

Commit 85085491 parent 6356b3c1 file · +4 −12Browse files

Unified · Split

apps/web/src/components/ui/toast.tsx+4−12
@@ -2,7 +2,7 @@ · 1 unmodified line
2 2
3import { Toast } from "@base-ui/react/toast";3import { Toast } from "@base-ui/react/toast";
4import { useEffect } from "react";4import { useEffect } from "react";
5import { useRouterState } from "@tanstack/react-router";5import { useParams } from "@tanstack/react-router";
6import {6import {
7 CircleAlertIcon,7 CircleAlertIcon,
8 CircleCheckIcon,8 CircleCheckIcon,
@@ -56,17 +56,9 @@ function shouldRenderForActiveThread( · 47 unmodified lines
56}56}
57 57
58function useActiveThreadIdFromRoute(): string | null {58function 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