Skip to content

WEB-697 fix(loan-products): ensure preview step is visible on edit#3153

Merged
IOhacker merged 1 commit intoopenMF:devfrom
shubhamkumar9199:fix/loan-product-edit-preview-visibility
Feb 14, 2026
Merged

WEB-697 fix(loan-products): ensure preview step is visible on edit#3153
IOhacker merged 1 commit intoopenMF:devfrom
shubhamkumar9199:fix/loan-product-edit-preview-visibility

Conversation

@shubhamkumar9199
Copy link
Contributor

@shubhamkumar9199 shubhamkumar9199 commented Feb 14, 2026

This PR solves a bug where the Preview step on the Edit Loan Product screen was hidden if no changes were made to the form. This confused users who expected to see the product details and a submit option, especially for loan products created with older UI versions.

WEB-697

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • 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

  • New Features

    • Loan product preview is now always visible when editing loan products, appearing regardless of prior edit state.
  • Bug Fixes

    • Submit button in the loan product preview now disables when the form is invalid.
    • Preview submit now correctly respects the current form validation state in real time, preventing submission of invalid changes.

@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 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(s) in object: '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

Walkthrough

Separates form validity from dirtiness by adding distinct getters; preview step is always rendered and receives validity via a new isValid input; the preview's Submit button is disabled when isValid is false.

Changes

Cohort / File(s) Summary
Validation state refactor
src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts
Reworked validity checks: introduced get loanProductFormValid(): boolean, added get loanProductFormDirty(): boolean, and reintroduced get loanProductFormValidAndNotPristine(): boolean as a composite of the two. Removed prior pristine-based logic from the primary validity getter.
Preview step rendering & API
src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html
Changed template to always include the preview step and bind its isValid input to loanProductFormValid instead of conditionally rendering it based on pristine state.
Preview component API & template
src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.ts, src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html
Added public @Input() isValid: boolean = true to the preview component; submit button now has [disabled]="!isValid" while preserving existing submit event emission.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • IOhacker
  • somasorosdpc
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main change: making the preview step visible on the edit loan product screen, which directly addresses the bug fix described in the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into dev

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts`:
- Around line 280-303: The getter loanProductFormDirty can throw a NPE because
loanIncomeCapitalizationForm is typed as UntypedFormGroup | null but accessed
without a null check in the advanced-payment branch; update the
loanProductFormDirty getter to defensively check loanIncomeCapitalizationForm
before reading .pristine (e.g., include a null-safe condition or use optional
chaining) so the advanced-payment path uses
loanIncomeCapitalizationForm?.pristine (or equivalent) when determining
dirtiness, leaving all other form checks (loanProductDetailsForm,
loanProductCurrencyForm, loanProductTermsForm, loanProductSettingsForm,
loanProductChargesStep, loanProductAccountingForm, and
wasPaymentAllocationChanged) unchanged.

@shubhamkumar9199 shubhamkumar9199 force-pushed the fix/loan-product-edit-preview-visibility branch from 6e1fc7c to 6f7a80f Compare February 14, 2026 11:57
@IOhacker IOhacker merged commit a857752 into openMF:dev Feb 14, 2026
5 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