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
22
33 import { Toast } from "@base-ui/react/toast";
44 import { useEffect } from "react";
5−import { useRouterState } from "@tanstack/react-router";
5+import { useParams } from "@tanstack/react-router";
66 import {
77 CircleAlertIcon,
88 CircleCheckIcon,
@@ -56,17 +56,9 @@ function shouldRenderForActiveThread( · 47 unmodified lines
5656 }
5757
5858 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,
7062 });
7163 }
7264