Skip to content

Disable Save button and show spinner during Agreement/Action creation/update#282

Merged
jhodapp merged 3 commits intomainfrom
fix/prevent-duplicate-agreement-action-creation
Feb 12, 2026
Merged

Disable Save button and show spinner during Agreement/Action creation/update#282
jhodapp merged 3 commits intomainfrom
fix/prevent-duplicate-agreement-action-creation

Conversation

@jhodapp
Copy link
Member

@jhodapp jhodapp commented Feb 12, 2026

Description

Prevents duplicate Agreements and Actions from being created or updated when the Save/Update button is clicked multiple times during backend latency. The Save/Update button is now disabled with a spinner while the mutation is in flight. Failed operations now display a user-facing error toast via sonner.

GitHub Issue: Fixes #281

Changes

  • Wired existing isLoading state from useAgreementMutation and useActionMutation hooks through CoachingTabsContainer to both list components as isSaving prop
  • Added Loader2 spinner icon and disabled state to Save/Update buttons in both AgreementsList and ActionsList
  • Guarded Enter key submission to prevent duplicate saves while a mutation is in flight
  • Added toast.error() notifications for failed save, update, and delete operations on both Agreements and Actions (including the completion toggle checkbox)
  • Replaced silent throw err re-throws with user-facing toast messages
  • Updated 5 test files to include the new isSaving prop in mockProps
  • Added 7 new tests verifying error toasts appear on each failure path

Screenshots / Videos Showing UI Changes (if applicable)

None, trivial chanages

Testing Strategy

  • All 447 unit tests pass
  • Production build succeeds
  • Manual testing: create an Agreement or Action and verify the button shows a spinner and is disabled during save
  • Manual testing: simulate a backend failure and verify an error toast appears

Concerns

  • None — this wires up existing infrastructure (isLoading from useEntityMutation) that was already being tracked but not surfaced to the UI. The toast uses the same sonner pattern already established across the codebase.

…ation

Prevents duplicate Agreements and Actions from being created when
the Save button is clicked multiple times during backend latency.

Wires existing isLoading state from useAgreementMutation and
useActionMutation hooks through CoachingTabsContainer to both
AgreementsList and ActionsList components. The Save/Update button
is now disabled with a spinner while the mutation is in flight,
and Enter key submission is also guarded.

Fixes #281
@jhodapp jhodapp changed the title fix: disable Save button and show spinner during Agreement/Action creation Disable Save button and show spinner during Agreement/Action creation Feb 12, 2026
@jhodapp jhodapp changed the title Disable Save button and show spinner during Agreement/Action creation Disable Save button and show spinner during Agreement/Action creation/update Feb 12, 2026
@jhodapp jhodapp self-assigned this Feb 12, 2026
@jhodapp jhodapp added enhancement Improves existing functionality or feature bug fix Fixes a specific Issue labels Feb 12, 2026
@jhodapp jhodapp added this to the 1.0.0-beta3 milestone Feb 12, 2026
@jhodapp jhodapp requested a review from calebbourg February 12, 2026 22:26
…lete

Replace silent throw-and-forget error handling with user-facing toast
notifications via sonner. Covers all mutation paths: create, update,
delete for both Agreements and Actions, plus the completion toggle
checkbox on Actions. Add 7 new tests verifying toast.error is called
with the correct message on each failure path.
@jhodapp jhodapp merged commit a3dcc1c into main Feb 12, 2026
6 checks passed
@jhodapp jhodapp deleted the fix/prevent-duplicate-agreement-action-creation branch February 12, 2026 23:11
@github-project-automation github-project-automation bot moved this from Review to ✅ Done in Refactor Coaching Platform Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Fixes a specific Issue enhancement Improves existing functionality or feature

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[Bug]: Can create duplicate assignments and actions

1 participant