fix(editor): close unsaved-guard nav bypass (#51) + coherent category change (#50) - #53
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 (
isStepOutOfOrderis correct), and the unsaved-changes guard (#35) fires on the back/cancel button and onbeforeunload. The real hole: the global nav pill is rendered on the editor, so clicking Library/Stock/Journal/etc. mid-edit callssetStatedirectly 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 inDevNav.#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.