feat(confidence-engine): use server investigation persistence
This commit is contained in:
@@ -11,10 +11,21 @@ export default function InvestigationPage({ params }) {
|
||||
const router = useRouter();
|
||||
const routeId = typeof params?.id === "string" ? params.id : "";
|
||||
const [existing, setExisting] = useState(null);
|
||||
const [hydrated, setHydrated] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!routeId) return;
|
||||
setExisting(loadInvestigation(routeId));
|
||||
let active = true;
|
||||
setHydrated(false);
|
||||
if (!routeId) { setHydrated(true); return; }
|
||||
(async () => {
|
||||
try {
|
||||
const snapshot = await loadInvestigation(routeId);
|
||||
if (active) setExisting(snapshot);
|
||||
} finally {
|
||||
if (active) setHydrated(true);
|
||||
}
|
||||
})();
|
||||
return () => { active = false; };
|
||||
}, [routeId]);
|
||||
|
||||
return (
|
||||
@@ -35,7 +46,9 @@ export default function InvestigationPage({ params }) {
|
||||
evidence-based structured reconstruction. This is a technical vertical
|
||||
slice — not a production system.
|
||||
</p>
|
||||
{existing ? (
|
||||
{!hydrated ? (
|
||||
<p className="text-sm text-gray-500">Loading investigation…</p>
|
||||
) : existing ? (
|
||||
<ScenarioForm
|
||||
investigationId={routeId}
|
||||
existingSnapshot={existing}
|
||||
|
||||
Reference in New Issue
Block a user