Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions apps/web/src/components/ui/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand Down
Loading