[Frontend] Wiki draft review: the body autosave "Saved" indicator is wiped on the next render #539
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while doing #182, which fixed the identical defect on the stat block autosave indicator in the same file and deliberately left this one alone.
In
webapp/frontend/src/pages/WikiDraftReview.jsx(around line 411) the body autosave effect writessetSaveState(s => s === "saving" ? s : "idle")whenever the form is clean, and it re-runs ondraft, which the successful save has just replaced. So "Saved" is set and overwritten with "idle" on the very next render: the autosave looks as though it did nothing, which is the one thing a silent background save must never look like. Since #182 the two indicators on that page disagree: the stat block's says "Saved" until the next edit, the body's still flashes.Why it was not folded into #182: the compiler rule did not flag this effect (it bails, almost certainly because the dirtiness test reads
lastSyncedRef.current), and fixing it honestly means promotinglastSyncedRefto state, which also changesisDirtyAgainstand the pre-approve flush inhandleApprove. That is a real refactor of the autosave path with 24 tests around it, for a cosmetic gain, and belongs with the wiki-and-review lane of the v4.4.0 rebuild (#535 phase 5b), where the design system's async-progress pattern replaces both indicators anyway.Acceptance:
lastSyncedRefis state (or the dirtiness comparison is otherwise render-visible) so the compiler rule can analyse the effect; noeslint-disable.setDraft.