WEB-964: Prevent duplicate repayment submissions#3609
Conversation
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Duplicate submission prevention via isSubmitting flag src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts, src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html |
ChangeDetectorRef is injected and an isSubmitting flag is added to track submission state. The submit() method now early-returns if the form is invalid or a submission is already in progress, sets isSubmitting = true and calls markForCheck() before submission. The submitRepayment() subscription error handler resets isSubmitting = false and calls markForCheck(). The template button binding includes isSubmitting in its disabled condition. |
Remove penalty error logging src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts |
Console logging was removed from loadPenalties() and waivePenalties() error handlers while retaining their functional behavior of clearing penalties and proceeding with repayment. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
- openMF/web-app#2957: Introduces the
submitRepaymentmethod and penalty-waiving flow that this PR builds upon with duplicate submission prevention. - openMF/web-app#2725: Adjusts form-submit button enablement logic; this PR extends the disabled condition with the additional
isSubmittingguard.
Suggested reviewers
- IOhacker
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'WEB-964: Prevent duplicate repayment submissions' directly and clearly describes the main change in the PR, which is preventing duplicate repayment submissions through an isSubmitting flag. |
| 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. |
✏️ 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.
Description
This PR prevents duplicate repayment submissions in the Make Repayment flow.
Previously, rapid multiple clicks on the Submit button could dispatch parallel repayment requests before the initial request completed, resulting in duplicate repayment transactions for the same loan account.
Changes Made
isSubmittingstate handlingmarkForCheck()synchronization forOnPushchange detection compatibilityThe existing repayment and penalty waiver business logic remains unchanged.
Related issues and discussion
WEB-964
Screenshots, if any
Before Fix
Before.Bug.mp4
After Fix
After.Fix.mp4
Checklist
web-app/.github/CONTRIBUTING.md.Summary by CodeRabbit