WEB-966: Prevent duplicate disbursement submissions#3616
Conversation
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Component setup for submission state tracking src/app/loans/loans-view/loan-account-actions/disburse-to-savings-account/disburse-to-savings-account.component.ts |
Imports ChangeDetectorRef and injects it as cdr. Adds an isSubmitting boolean flag initialized to false to track whether a disbursement submission is currently in flight. |
Submit method with duplicate prevention guard src/app/loans/loans-view/loan-account-actions/disburse-to-savings-account/disburse-to-savings-account.component.ts |
The submit() method early-returns if the form is invalid or a submission is already in progress. When valid, it sets isSubmitting = true and calls markForCheck() to ensure immediate UI updates. |
Subscription refactoring and button disabling src/app/loans/loans-view/loan-account-actions/disburse-to-savings-account/disburse-to-savings-account.component.ts, disburse-to-savings-account.component.html |
The API subscription now uses explicit next and error handlers. The error handler resets isSubmitting to false and marks for check. The template disables the Submit button when either the form is invalid or a submission is in progress. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
- openMF/web-app#3609: Applies the same duplicate submission prevention pattern with
isSubmittingflag,markForCheck(), and button disabling to the make-repayment loan action component.
Suggested reviewers
- alberto-art3ch
- adamsaghy
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly and specifically describes the main objective of the changeset: preventing duplicate disbursement submissions through state locking and UI disabling logic. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
|
LGTM |
Description
This PR prevents duplicate disbursement submissions in the "Disburse to Savings" workflow.
Previously, rapid repeated clicks on the Submit button could dispatch multiple concurrent HTTP POST requests before the initial request completed and navigation occurred.
This resulted in backend validation conflicts such as:
The issue occurred because the submit button remained interactive during the async request lifecycle.
This PR introduces:
isSubmittingstate lockingmarkForCheck()updates for OnPush change detection compatibilityScreenshots, if any
Attached:
Before.Bug.mp4
After.Fix.mp4
Checklist
web-app/.github/CONTRIBUTING.md.Summary by CodeRabbit