Skip to content

fix(ui): let one dialog flow run at a time - #250

Merged
mrcsin merged 1 commit into
masterfrom
conflict-dialog-flows
Nov 30, 2026
Merged

mrcsin merged 1 commit into
masterfrom
conflict-dialog-flows

Conversation

@mrcsin

@mrcsin mrcsin commented Nov 30, 2026

Copy link
Copy Markdown
Member

Problem

The app could show several dialogs at once and act behind them. A conflict found while the Open picker, a prompt or the style window was open popped its dialog on top, and the command behind it could replace or write the recipe meanwhile. A reconnect take could replace the screen recipe while a dialog was open. A link drop left the conflict dialog open with an outdated PLC recipe. A close request during a dialog either stacked an exit prompt or was refused with nothing visible in front.

What changed

  • AppFlows, one UI-thread counter, tracks operator commands that can open a dialog: New, Open, Save, Save As, the style window, the conflict dialog with its take, and the exit flow. Each command opens a scope at its start and ends it in finally, so native pickers and the gaps between chained dialogs count, and an exception cannot leave it open. It replaces _exitChoiceInProgress.
  • A conflict found during a flow waits, with the link slot on "ПЛК: конфликт рецептов"; when the last flow ends, a new comparison runs against the current screen recipe off the UI thread. At most one conflict dialog exists. A reconnect take during a flow becomes a waiting conflict.
  • A link drop closes the conflict dialog with its own result; sync stays on and the next connect compares again. A link drop during the take's prompt or picker abandons the take after the save.
  • A close request while a dialog, picker or busy look is in front is ignored and the app's top window is activated; in a phase with nothing in front, the request is kept and runs the exit checks when the command ends, unless a new dialog opens first. Closing the window stops any pending comparison.
  • The take-hold guard added in fix(ui): make a recipe taken from the PLC untitled #249 is removed; AppFlows covers it. Conflict handling moves from MainWindowViewModel (now 293 lines) into PlcConflictFlow.
  • dialogs-and-interactions.md and docs/readme.md describe the rule.

This is Task 6 of docs/plans/20261130-recipe-replace-save-exit-safety.md.

Verification

  • Build 0 warnings; full suite 2352 tests in three runs: 0, 1 and 0 failed. The one failure is the allocation probe AppendStep_PerSurfaceTailAllocation, which also failed once before this change and does not touch dialogs.
  • Tests cover rows A10-A14, B3, G1 (ignored and kept), the prompt-to-picker gap, a conflict behind the Open picker, a conflict waiting while the exit closes the window, and a kept close superseded by a new picker.
  • Live against the PLC emulator: a close request with the conflict dialog open left the dialog and the app open; "Оставить локальный" then showed "подключено".
  • Code review and an independent review; their findings are fixed in this PR.

🤖 Generated with Claude Code

The conflict dialog opened whenever a comparison found a difference,
whatever was on screen. Behind the unsaved-changes prompt, a file
picker or the style window it stacked a second modal, and in the gap
between a prompt and its picker it could open first, so the picker
then opened over it. A reconnect take replaced the recipe behind an
open picker. A link drop left a dialog for a stale conflict on screen,
and a close request during the dialog closed the window with it, which
read as "closed without a choice" and turned sync off.

AppFlows counts every operator command that can open a dialog, from
its start to a finally, native pickers and the gaps between chained
dialogs included. A native picker is not an app window, so only a
per-command count sees it. A conflict or reconnect take during a flow
waits; the write pause holds and the link slot shows the conflict.
When the count reaches zero, Core compares again on the thread pool
against the current screen recipe, so the dialog never acts on a
recipe read before the wait. A link drop closes the dialog with its
own result and keeps sync on. A close request is ignored while a
dialog, picker or busy look is in front, and kept until the flow ends
otherwise; a dialog the flow opens later drops it. The exit flow uses
the same scopes instead of its own guard flag, and a closed window
shuts the counter down, so nothing compares again after exit.

A save is a flow, so the take hold that kept a take from landing
during a save is gone. The conflict handling moves from
MainWindowViewModel to PlcConflictFlow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrcsin
mrcsin marked this pull request as ready for review November 30, 2026 19:19
@mrcsin
mrcsin merged commit 77f6e10 into master Nov 30, 2026
1 check passed
@mrcsin
mrcsin deleted the conflict-dialog-flows branch November 30, 2026 19: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.

1 participant