Skip to content

Fix/settlements in flight guard#329

Merged
Jagadeeshftw merged 3 commits into
AnchorNet-Org:mainfrom
egwujiohaifesinachiperpetual-max:fix/settlements-in-flight-guard
Jul 23, 2026
Merged

Fix/settlements in flight guard#329
Jagadeeshftw merged 3 commits into
AnchorNet-Org:mainfrom
egwujiohaifesinachiperpetual-max:fix/settlements-in-flight-guard

Conversation

@egwujiohaifesinachiperpetual-max

Copy link
Copy Markdown
Contributor

Closes #265
📌 Summary SettlementsPanel's runSettlementAction previously had no per-settlement "in-flight" guard. SettlementTable's Execute and Cancel action buttons remained enabled and clickable for the entire duration of an in-flight executeSettlement or cancelSettlement request. This allowed users to double-click or fire duplicate mutating API calls for the same settlement ID.

This PR adds a client-side UX guard that tracks in-flight settlement IDs in a Set state and disables a row's Execute and Cancel buttons while a request for that specific settlement ID is pending. Other rows remain fully actionable.

🧩 Changes Made

State Tracking: Added pendingSettlementIds (Set) state in SettlementsPanel.tsx.
In-flight Handling: runSettlementAction adds settlement id to pendingSettlementIds before sending an execute or cancel request, and removes it in a finally block.
UI Action Disabling: Passed pendingIds down to SettlementTable.tsx and set disabled={isPending} on both Execute and Cancel buttons for rows whose ID is currently pending.
Unit Tests:
SettlementTable.test.tsx: Added test verifying pendingIds disables action buttons for that specific row without affecting other rows.
SettlementsPanel.test.tsx: Added integration unit tests verifying row action buttons become disabled during in-flight executeSettlement and cancelSettlement operations and re-enable/update upon completion.
✅ Verification

Unit tests: npx vitest run src/components/SettlementTable.test.tsx src/components/SettlementsPanel.test.tsx (Passed 31/31 tests).
Production build: npm run build completed successfully without errors.
5:02 PM

# Conflicts:
#	src/components/SettlementTable.test.tsx
#	src/components/SettlementTable.tsx
#	src/components/SettlementsPanel.test.tsx
@Jagadeeshftw
Jagadeeshftw merged commit 809bc65 into AnchorNet-Org:main Jul 23, 2026
1 check failed
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.

SettlementsPanel's per-row Execute/Cancel actions have no in-flight guard against duplicate clicks

2 participants