Repository navigation
fix(ui): keep the unsaved mark true to the file - #245
Merged
Merged
Conversation
The unsaved mark did not always match the file on disk. Undo back to the saved state kept the mark. An edit made while a save was writing lost its mark, because the save marked whatever was current after the write, and a prompt "Save" then let exit, New or Open drop that edit. A run that started during the New or Open prompt or the Open picker stopped the action silently. - RecipeSession keeps the saved recipe instance and computes IsDirty from it, so undo or redo back to that state clears the mark and the next step away sets it again. - SaveRecipeAsync marks saved the recipe it wrote, not the current one, so an edit during the write stays unsaved. - The prompt answer Save lets the caller drop the recipe only when the save succeeded and the recipe is still clean. - New and Open are disabled while a save runs, so a late save cannot point the file name at a different recipe. - New and Open report the RunBlocksOpenOrNew warning when a run started during their dialog. Open also checks after the prompt, before the picker. - LoadRecipeFromPlcAsync and PlcLifecycleManager.ReadRecipeFromPlcAsync had no production caller and are deleted. Their test duplicated ConflictResolvedWithThePlcRecipe_StartsWithoutMarks and is removed. - CsvFileIo flushes the temporary file to disk before it replaces the target, off the UI thread, so a power loss cannot leave an empty recipe file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
The unsaved mark and the file it describes could disagree:
What changed
CsvFileIoflushes the temporary file to disk off the UI thread before the move.LoadRecipeFromPlcAsyncandPlcLifecycleManager.ReadRecipeFromPlcAsyncare deleted; they had no production caller.docs/readme.mddescribes the unsaved mark and undo.This is Task 8 of
docs/plans/20261130-recipe-replace-save-exit-safety.md.Verification
dotnet format --verify-no-changesclean.🤖 Generated with Claude Code