Skip to content

fix: keep task modal open when save validation fails (#2421) - #2422

Merged
callumalpass merged 3 commits into
callumalpass:mainfrom
andriyor:fix/modal-save-validation
Oct 26, 2026
Merged

callumalpass merged 3 commits into
callumalpass:mainfrom
andriyor:fix/modal-save-validation

Conversation

@andriyor

Copy link
Copy Markdown
Contributor

Fixes #2421.

The Save button closed the task modal as soon as handleSave() resolved, even when it returned early on validation (for example an empty title). The notice asked the user to fill in a field, but the form had already been discarded.

Changes

  • runTaskModalSaveAction() calls onSaved() (which closes the modal) only when onSave() does not resolve to false.
  • TaskCreationModal.handleSave() and TaskEditModal.handleSave() return false when the title check fails. The abstract signature becomes Promise<boolean | void>, so other callers are unaffected.
  • Unit test for the new path in taskModalActionButtons.test.ts.

Testing

  • npx jest tests/unit/modals: passing
  • tsc -noEmit --skipLibCheck: clean

This is also a prerequisite for #2420 (required modal fields), which I'll send as a separate PR.

🤖 Generated with Claude Code

The Save button closed the modal as soon as handleSave() resolved, even
when it returned early on validation (e.g. empty title), discarding the
form. handleSave() now returns false on validation failure and the save
action skips the close callback in that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@callumalpass
callumalpass merged commit 0c8bd84 into callumalpass:main Oct 26, 2026
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.

[Bug]: Task modal closes and discards the form when Save fails validation

2 participants