Famous people: a page without its portrait is not cached; the admin list refreshes
CI / test (push) Successful in 1m57s
CI / build (push) Skipped
CI / deploy (push) Skipped

The worker does not clear the page cache when the portrait is done, so a
page loaded right after publishing showed "hamarosan elkészül" for five
minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-22 16:59:07 +00:00
co-authored by Claude Opus 5.5
parent 37cb0abf4b
commit 2997a06474
2 changed files with 18 additions and 3 deletions
@@ -2,7 +2,7 @@
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { BirthForm } from "@/app/profil/BirthForm";
import { api, errorText } from "@/lib/api";
@@ -24,11 +24,19 @@ export function AdminCelebrities() {
const [adding, setAdding] = useState(false);
const [subtitle, setSubtitle] = useState("");
useEffect(() => {
const load = useCallback(() => {
api<{ celebrities: AdminCelebrityRow[] }>("/admin/celebrities")
.then((r) => setRows(r.celebrities))
.catch((e) => setError(errorText(e)));
}, []);
useEffect(load, [load]);
// A portrait being written: look again now and then.
const writing = rows?.some((c) => c.analysis_status === "pending" || c.analysis_status === "running");
useEffect(() => {
if (!writing) return;
const t = setInterval(load, 10_000);
return () => clearInterval(t);
}, [writing, load]);
return (
<section className="field" style={{ gap: 18 }}>