Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 6daaefcde8d3deef3323d7ffea79ad0b49e7cba9
parent 5ded8cfad04ccd9818799b6fa173ac7ecd41c6fd
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 22:50:34 -0400

editor: Settings' save says "Saved." at once — the action no longer revalidates /settings (its answer waited on the router applying the revalidated tree, which a save made while the page's link prefetches were in flight did only at the next AutoRefresh pulse, ~5 s, or never with auto-refresh off); the form refreshes the tree after the answer. cookies-mode.spec:73 green 3/3 alone

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Meditor/app/settings/actions.ts | 10++++++++--
Meditor/app/settings/components/SettingsForm.tsx | 11++++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/editor/app/settings/actions.ts b/editor/app/settings/actions.ts @@ -1,6 +1,5 @@ "use server"; -import { revalidatePath } from "next/cache"; import { AUTO_REFRESH_INTERVAL_MAX_SECONDS, getSettings, @@ -262,6 +261,13 @@ export async function saveSettingsAction( } catch (e) { return { ok: false, error: (e as Error).message, values }; } - revalidatePath("/settings"); + // NO revalidatePath here. With it, the action's answer (and so the form's + // "Saved.") was committed only once the client router applied the + // revalidated /settings tree — which, for a save made while the page's + // link prefetches were still in flight, did not happen until some LATER + // router refresh: AutoRefresh's next pulse (~5 s), or never with + // auto-refresh off (measured: 5 of 12 saves never said "Saved." with the + // interval at 0; 18 of 18 did within 0.25 s without it). The form refreshes + // the tree itself once the answer is in (SettingsForm). return { ok: true }; } diff --git a/editor/app/settings/components/SettingsForm.tsx b/editor/app/settings/components/SettingsForm.tsx @@ -1,7 +1,8 @@ "use client"; -import { useActionState, useState } from "react"; +import { useActionState, useEffect, useState } from "react"; import Link from "next/link"; +import { useRouter } from "next/navigation"; import { saveSettingsAction, type SaveResult, @@ -37,6 +38,14 @@ export function SettingsForm({ initial }: Props) { const [social, setSocial] = useState<SocialRow[]>(() => initial.socialLinks.map(toSocialRow), ); + // A save answers first ("Saved."), THEN the server-rendered parts that read + // settings (the sidebar's title, the X login source) are re-rendered: the + // action does not revalidate, so its answer never waits on the router (see + // saveSettingsAction). + const router = useRouter(); + useEffect(() => { + if (state?.ok) router.refresh(); + }, [state, router]); return ( <form action={formAction} className="flex flex-col gap-4 max-w-xl">