Skip to content

Website edit session: an edited page buffer is discarded on page navigation (sourceBySlug never receives onChange) #469

Description

@abalter

What. In a live website edit session, an edited page's buffer is silently discarded when the author navigates to another page and back. showEditPage's onChange updates only the local currentSource (browser.js:1827); sourceBySlug is written only at page load (browser.js:1509). Re-entering the page re-mounts the ORIGINAL fetched source — keystrokes and settings-gear writes are equally lost.

Why it reads as a defect, not a design. The map's own comment (browser.js:1474: "slug → source TEXT (the editor's value in edit mode; no re-fetch)") describes the editor's value living there, and the standalone book edit loop DOES persist per-chapter edits across chapter navigation in its sources map (browser.js:903-915) — the website loop is the asymmetry.

Found during #445 — it blocked a nav-and-return read-back fixture for the expanded gear (the deliberate not-covered note is in master-website-live.test.js). If discard-on-nav is intended (unsaved edits dropped on leaving a page), it should be ruled and documented instead; today it is neither.

Candidate fix. One-line write-back in the article-branch onChange (sourceBySlug.set(slug, s)), plus the book branch's embedded loop already self-persists. A fixture: edit → nav away → nav back → the edit is still in the buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwebsite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions