Skip to content

Add confirmation flow for clearing completed todos#794

Merged
multiplex55 merged 1 commit intomasterfrom
codex/implement-confirmation-for-clear-completed-action
Feb 4, 2026
Merged

Add confirmation flow for clearing completed todos#794
multiplex55 merged 1 commit intomasterfrom
codex/implement-confirmation-for-clear-completed-action

Conversation

@multiplex55
Copy link
Copy Markdown
Owner

Motivation

  • Prevent immediate destructive mutation of the todo list when the user clicks "Clear Completed" by requiring explicit confirmation.
  • Keep the UI state and persisted todo.json in sync after a confirmed clear.

Description

  • Add a pending_clear_confirm: bool field to TodoDialog and initialize it in open to track awaiting confirmation.
  • Replace the immediate entries.retain(...) behavior with a local confirmation UI rendered inside the todo dialog and a helper confirm_clear_completed(&mut self, app: &mut LauncherApp, confirmed: bool) that only mutates and persists entries when confirmed.
  • Wire the dialog buttons so clicking "Clear Completed" sets pending_clear_confirm = true and the dialog shows a small confirm/cancel row; clicking confirm invokes the helper to remove done items and call save(...) only if the list changed.
  • Add unit tests clear_completed_requires_confirmation and clear_completed_after_confirmation_saves to cover the unconfirmed/confirmed flows and persistence via load_todos/save_todos.

Testing

  • Added unit tests in src/gui/todo_dialog.rs: clear_completed_requires_confirmation and clear_completed_after_confirmation_saves which assert no removal before confirmation and proper removal + save after confirmation.
  • No automated test run was performed as part of this change (tests were added but not executed in CI/local run).

Codex Task

@multiplex55 multiplex55 merged commit 205ca12 into master Feb 4, 2026
1 check passed
@multiplex55 multiplex55 deleted the codex/implement-confirmation-for-clear-completed-action branch February 7, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant