"use client"; import { useEffect } from "react"; import { useRouter } from "next/navigation"; // Refresh the page once a save's state has landed (lib/formState.ts // seedAfterSave, release 24 H5): the save does not revalidate, so its // confirmation commits on its own, and this brings the rest of the page — // a heading, a list, a Publish row — up to date in a transition of its own. export function useRefreshAfterSave(state: { ok?: boolean } | null | undefined): void { const router = useRouter(); useEffect(() => { if (state && state.ok === true) router.refresh(); }, [state, router]); }