Files
sofa/components/update-toast.tsx
T
jake 7ed172d675 Replace Jotai atoms with local state, add Suspense for PPR compatibility
- Delete filterable-row, backup-schedule, integrations, and system-health
  atom files; replace with useState/useTransition + server action calls
- Replace /api/explore/discover route with discoverByGenre server action;
  refactor FilterableTitleRow to call it directly via useTransition
- Wrap PagesLayout and AuthLayout children in Suspense to fix dynamic
  rendering errors during PPR static generation; remove StoreProvider
- Sequence ExplorePage session fetch before TMDB calls to prevent
  build-time requests during static generation
- Drop unnecessary "use client" directives from dashboard and person
  components that have no client-side hooks or browser API usage
- Improve Dockerfile: add bun install layer cache mount, copy
  .next/cache from builder, reorder ENV declarations
2026-03-07 16:00:19 -05:00

35 lines
1.0 KiB
TypeScript

"use client";
import { useAtom } from "jotai";
import { useEffect } from "react";
import { toast } from "sonner";
import { getUpdateCheckAction } from "@/lib/actions/settings";
import { updateToastDismissedVersionAtom } from "@/lib/atoms/update-check";
export function UpdateToast() {
const [dismissedVersion, setDismissedVersion] = useAtom(
updateToastDismissedVersionAtom,
);
useEffect(() => {
void getUpdateCheckAction().then((data) => {
if (!data?.updateAvailable) return;
if (dismissedVersion === data.latestVersion) return;
setDismissedVersion(data.latestVersion);
toast.info(`Sofa v${data.latestVersion} is available`, {
description: `You're running v${data.currentVersion}.`,
duration: 15_000,
action: data.releaseUrl
? {
label: "View release",
onClick: () => window.open(data.releaseUrl as string, "_blank"),
}
: undefined,
});
});
}, [dismissedVersion, setDismissedVersion]);
return null;
}