Skip to content
TypeScript

perf(web): toasts compile without manual memoization (#20702)

Julius Marmingeb413396fe8c7
diff --git a/apps/web/src/components/ui/toast.tsx b/apps/web/src/components/ui/toast.tsx
index 87bfe2f984f..f6a84f91bab 100644
--- a/apps/web/src/components/ui/toast.tsx
+++ b/apps/web/src/components/ui/toast.tsx
@@ -5,7 +5,6 @@ import { Spinner } from "~/components/ui/spinner";
import { Toast } from "@base-ui/react/toast";
import {
useEffect,
- useMemo,
useState,
type CSSProperties,
type ComponentPropsWithoutRef,
@@ -420,18 +419,16 @@ function useActiveThreadRefFromRoute(): ScopedThreadRef | null {
routeTarget?.kind === "draft" ? store.getDraftSession(routeTarget.draftId) : null,
);
- return useMemo(() => {
- if (routeTarget?.kind === "server") {
- return routeTarget.threadRef;
- }
- if (routeTarget?.kind === "draft" && activeDraftSession) {
- return {
- environmentId: activeDraftSession.environmentId,
- threadId: activeDraftSession.threadId,
- };
- }
- return null;
- }, [activeDraftSession, routeTarget]);
+ if (routeTarget?.kind === "server") {
+ return routeTarget.threadRef;
+ }
+ if (routeTarget?.kind === "draft" && activeDraftSession) {
+ return {
+ environmentId: activeDraftSession.environmentId,
+ threadId: activeDraftSession.threadId,
+ };
+ }
+ return null;
}
function ThreadToastVisibleAutoDismiss({