Repository navigation
fix(ui): make a recipe taken from the PLC untitled - #249
Merged
Merged
Conversation
"Загрузить из ПЛК" kept the old file name, so the next Ctrl+S wrote the PLC recipe over that CSV (#234). The take also dropped unsaved edits without the "Сохранить изменения?" prompt and loaded the recipe the comparison had read before the dialog opened, which could be minutes old. The conflict answer now runs one take path, PlcRecipeTake. On a dirty recipe it asks first: Save saves (Save As when untitled) and takes only when the save succeeded, Don't save takes, Cancel or a failed save shows the conflict dialog again. Then it reads the PLC recipe again under a busy look (transparent overlay, wait cursor, keys blocked, link slot "ПЛК: чтение рецепта…") bounded at 10 s in the UI. PlcLifecycleManager.TakeConflictRecipe decides on the UI thread: a failed or timed-out read changes nothing, reports it and declares link loss; an empty or uncommitted PLC recipe ends the conflict with a write of the screen recipe; an identical one ends it in sync; a screen that changed during the read asks again. Both this take and the reconnect take load through PlcComparisonAnswers.TakeLocked, which writes nothing back and calls the new ConfirmInSync, so the status is Synced and a failed write's red latch clears. RecipeCoordinator raises PlcRecipeTaken after a take, and RecipeFileViewModel drops the file name: the title reads "SemiStep - Рецепт из ПЛК *", the recipe is unsaved with empty undo history, and Save opens Save As until a Save As, New or Open succeeds. The ResolveConflict answer TakePlc is gone, so nothing else replaces the session recipe from the PLC. A save command holds every take until it ends, and a take that lands during the write keeps the recipe untitled, so a late save cannot put its file name back on the taken recipe. The take checks before the read that its conflict is still current: a link drop during the prompt ends it without a read and without showing a stale dialog again. The window refuses a close request during the busy look. A link-loss fault that follows a failed take read is dropped once, and only when that read declared the link loss. Closes #234 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
Taking the PLC recipe (conflict dialog "Загрузить из ПЛК", or reconnect onto an empty screen) kept the previous file name, so the next Ctrl+S overwrote that CSV with the PLC recipe and the title still named the old file (#234). The take also dropped unsaved edits without the "Сохранить изменения?" prompt, with the undo history cleared, and it loaded the PLC recipe read when the conflict was found, which could be outdated after the dialog waited.
What changed
PlcRecipeTake.RunAsync,PlcLifecycleManager.TakeConflictRecipe,PlcComparisonAnswers.TakeLocked,RecipeCoordinator.CompleteTake.ConfirmInSyncthen sets the status to Synced, so a red sync error from before clears.docs/readme.md,dialogs-and-interactions.mdanderror-reporting.mddescribe the take.This is Task 5 of
docs/plans/20261130-recipe-replace-save-exit-safety.md.Verification
dotnet format --verify-no-changesclean.Closes #234
🤖 Generated with Claude Code