Skip to content

WEB-964: Prevent duplicate repayment submissions#3609

Merged
alberto-art3ch merged 1 commit into
openMF:devfrom
Mahesh-Gite-28:WEB-964-prevent-duplicate-repayment-submissions
May 24, 2026
Merged

WEB-964: Prevent duplicate repayment submissions#3609
alberto-art3ch merged 1 commit into
openMF:devfrom
Mahesh-Gite-28:WEB-964-prevent-duplicate-repayment-submissions

Conversation

@Mahesh-Gite-28
Copy link
Copy Markdown
Contributor

@Mahesh-Gite-28 Mahesh-Gite-28 commented May 24, 2026

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

  • Added local isSubmitting state handling
  • Disabled the submit button during active repayment requests
  • Restored submission state on request failure
  • Added markForCheck() synchronization for OnPush change detection compatibility

The existing repayment and penalty waiver business logic remains unchanged.

Related issues and discussion

WEB-964

Screenshots, if any

Before Fix

  • Multiple repayment requests were triggered when the submit button was clicked rapidly.
Before.Bug.mp4

After Fix

  • The submit button is disabled immediately after the first click.
  • Only one repayment request is processed.
After.Fix.mp4

Checklist

  • If you have multiple commits please combine them into one commit by squashing them.
  • Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced loan repayment form to prevent duplicate submissions by disabling the Submit button when a submission is already in progress.
    • Improved error handling by removing unnecessary logging for penalty-related operations while maintaining repayment functionality.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "pre_merge_checks"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a516b553-fb9f-4edd-82fa-9af8334b25f4

📥 Commits

Reviewing files that changed from the base of the PR and between d3a4a99 and 8998cc4.

📒 Files selected for processing (2)
  • src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html
  • src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts

Walkthrough

The MakeRepaymentComponent now prevents duplicate form submissions by introducing an isSubmitting flag that gates the submit method, resets on errors, and disables the submit button during submission. Penalty-related error logging was removed from error handlers while preserving functional behavior.

Changes

Make Repayment Form Submission Control

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 submitRepayment method 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 isSubmitting guard.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Collaborator

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alberto-art3ch alberto-art3ch merged commit e04e10f into openMF:dev May 24, 2026
6 checks passed
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.

2 participants