Skip to content

WEB-1166: Fix chargeId race condition in charge forms - #4044

Merged
IOhacker merged 2 commits into
openMF:devfrom
jamalkamaladdin:WEB-1166-charge-switchmap
Sep 25, 2026
Merged

IOhacker merged 2 commits into
openMF:devfrom
jamalkamaladdin:WEB-1166-charge-switchmap

Conversation

@jamalkamaladdin

@jamalkamaladdin jamalkamaladdin commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add Charge forms for client, savings, fixed deposit and recurring deposit accounts load the charge template in a nested subscribe. A slow response for an older charge can overwrite the form after a newer selection.

Template lookup now runs inside switchMap. Only the response for the latest chargeId reaches the form.

A failed lookup maps to EMPTY through catchError. Later selections still load their template.

Fixed deposit and recurring deposit forms now unsubscribe with takeUntilDestroyed, same as client and savings forms.

add-client-charge.component.spec.ts gets two specs: out of order template responses, and a new selection after a failed lookup. Out of order spec fails on dev with amount 100 instead of 200.

No new dependencies.

Related issues and discussion

https://mifosforge.jira.com/browse/WEB-1166

Screenshots, if any

No visual change.

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
    • Charge details now reflect the most recently selected charge, even when an earlier template request finishes later.
    • A failed template lookup no longer prevents subsequent charge selections from loading.

@jamalkamaladdin
jamalkamaladdin requested a review from a team September 24, 2026 10:27
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: openMF/web-app/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 07daa5d1-9127-4b45-8cb6-ed7a41de4e81

📥 Commits

Reviewing files that changed from the base of the PR and between 174b292 and fa0370f.

📒 Files selected for processing (5)
  • src/app/clients/clients-view/client-actions/add-client-charge/add-client-charge.component.spec.ts
  • src/app/clients/clients-view/client-actions/add-client-charge/add-client-charge.component.ts
  • src/app/deposits/fixed-deposits/fixed-deposits-account-actions/add-charge-fixed-deposits-account/add-charge-fixed-deposits-account.component.ts
  • src/app/deposits/recurring-deposits/recurring-deposits-account-actions/add-charge-recurring-deposits-account/add-charge-recurring-deposits-account.component.ts
  • src/app/savings/saving-account-actions/add-charge-savings-account/add-charge-savings-account.component.ts
 _______________________________________________________________________________
< Design to test. Start thinking about testing before you write a line of code. >
 -------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@IOhacker
IOhacker merged commit 632bb35 into openMF:dev Sep 25, 2026
5 of 7 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