Fix/settlements in flight guard#329
Merged
Jagadeeshftw merged 3 commits intoJul 23, 2026
Merged
Conversation
# Conflicts: # src/components/SettlementTable.test.tsx # src/components/SettlementTable.tsx # src/components/SettlementsPanel.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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