Skip to content

home: derive confirmation dialog presentation from the pending action - #8003

Open
ianplusplus wants to merge 1 commit into
utmapp:mainfrom
ianplusplus:fix/confirm-action-reset
Open

ianplusplus wants to merge 1 commit into
utmapp:mainfrom
ianplusplus:fix/confirm-action-reset

Conversation

@ianplusplus

Copy link
Copy Markdown

The confirmation dialog in VMConfirmActionModifier was presented by mirroring confirmAction into a separate isPresented state with onChange, but nothing ever cleared confirmAction after the dialog was dismissed. Requesting the same action on the same VM again (for example cloning a VM twice) produced an equal value, so onChange never fired and the dialog silently failed to appear until the app was restarted. The same stale state also blocked Stop and Move on that VM.

Replace the mirrored state with a binding derived from confirmAction, as VMSnapshotsView already does, so dismissal clears the action and there is a single source of truth for whether the dialog is shown.

Testing: Tested by a human on macOS 27.0.1, MacBook Pro (Apple M5 Pro). Reproduced the bug on the release build (second Clone on the same VM shows no dialog), then confirmed with this change that cloning the same VM repeatedly from both the toolbar and the context menu prompts every time. The author acknowledges that this change has been tested and/or reviewed by a human in accordance with UTM's AI contribution guidelines.

The confirmation dialog was presented by mirroring `confirmAction` into a
separate `isPresented` state with `onChange`, but nothing ever cleared
`confirmAction` after the dialog went away. Requesting the same action on
the same VM again (for example cloning a VM twice) produced an equal
value, so `onChange` never fired and the dialog silently failed to appear
until the app was restarted.

Replace the mirrored state with a binding derived from `confirmAction`,
as VMSnapshotsView already does, so dismissal clears the action and there
is a single source of truth for whether the dialog is shown.

Assisted-by: Claude:claude-fable-5-1
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