Skip to content

fix(editor): close unsaved-guard nav bypass (#51) + coherent category change (#50) - #53

Merged
ndreno merged 1 commit into
mainfrom
fix/editor-guards-and-category
Jun 17, 2026
Merged

fix(editor): close unsaved-guard nav bypass (#51) + coherent category change (#50)#53
ndreno merged 1 commit into
mainfrom
fix/editor-guards-and-category

Conversation

@ndreno

@ndreno ndreno commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Phase 5 (regressions/bugs in shipped editor features), from the third forum batch. Closes #51 and #50.

#51 — unsaved-changes guard bypassed by the top nav

Finding: both 0.5.0 guards are actually intact — the out-of-sequence step guard (#37) works (isStepOutOfOrder is correct), and the unsaved-changes guard (#35) fires on the back/cancel button and on beforeunload. The real hole: the global nav pill is rendered on the editor, so clicking Library/Stock/Journal/etc. mid-edit calls setState directly and navigates away without prompting, silently discarding the draft. (Pre-existing since the guard shipped, not strictly a 0.5.0 change — but it's the gap Arwen hit.)

Fix: treat the editor as a focused mode like the brew screen and hide the nav pill on edit_recipe. Every exit now routes through the guarded back/cancel button or Save. One-line change in DevNav.

#50 — changing a fermentable's category corrupts the row

Finding: the category dropdown only swapped type, leaving the old name and the grain's EBC/yield in place (a "honey" still named Pale 2-Row at 4 EBC / 80% yield), and the category-scoped picker (#34) could no longer re-find the original ingredient — a stuck, incoherent row.

Fix: changeFermentableType() resets the row to a clean entry for the new type, keeping the amount the brewer set; no-op on a redundant re-select so it never wipes a row needlessly. Picking from the catalog still re-syncs everything as before.

Tests

3 new unit tests for changeFermentableType (reset on real change, amount preserved, no-op when unchanged). Full suite: 353 passing.

Verification

pnpm typecheck · pnpm lint · pnpm test (353) · vite build — all clean.

… change (#50)

#51: the unsaved-changes guard covered the back button + beforeunload, but the
global nav pill was still rendered on the editor, so clicking a nav button
navigated away (setState) without prompting. Hide the nav pill on edit_recipe
the same way it's hidden during a brew — the editor's only exits (back/cancel,
Save) already run through the guard.

#50: changing a fermentable's category only swapped 'type', leaving the old
name + grain EBC/yield behind, and the category-scoped picker (#34) couldn't
re-find the original. changeFermentableType() now resets the row to a clean
entry for the new type (keeping amount); no-op on a redundant select.
@ndreno
ndreno merged commit 3d34e3f into main Jun 17, 2026
1 check passed
@ndreno
ndreno deleted the fix/editor-guards-and-category branch June 17, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor/brew warnings (unsaved changes #35, out-of-sequence #37) appear partly missing in 0.5.0 — possible regression

1 participant