WEB-697 fix(loan-products): ensure preview step is visible on edit#3153
Conversation
|
Note
|
| 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.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
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.
src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts
Show resolved
Hide resolved
6e1fc7c to
6f7a80f
Compare
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
Bug Fixes