Skip to content

Conversation

@alberto-art3ch
Copy link
Collaborator

@alberto-art3ch alberto-art3ch commented Feb 9, 2026

Description

There was an issue in the Loan Originator view due optional fields: Channel Type and Originator Type

WEB-642

Screenshots, if any

Screen.Recording.2026-02-09.at.10.09.45.a.m.mov

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

    • Added a Back button to the loan originator view page for easier navigation.
  • Bug Fixes

    • Improved stability in the loan originator editing interface by implementing safer handling of potentially missing data values.

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 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

This PR introduces null-safety improvements to the loan originator components by making the form property nullable with optional chaining for nested property access, and adds a Back button to the view component's template.

Changes

Cohort / File(s) Summary
Loan Originator Components
src/app/organization/loan-originators/edit-loan-originator/edit-loan-originator.component.ts, src/app/organization/loan-originators/view-loan-originator/view-loan-originator.component.html
Made form property nullable and added optional chaining (?.) for originatorType and channelType property access to handle potentially undefined values safely. Added Back button to view template with router navigation and translation support.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • adamsaghy
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: making the loan originator view handle optional fields (Channel Type and Originator Type) safely through null handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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

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/organization/loan-originators/edit-loan-originator/edit-loan-originator.component.ts`:
- Line 38: The field loanOriginatorForm is declared as Nullable but submit()
directly accesses this.loanOriginatorForm.value; change loanOriginatorForm to
use definite assignment (remove | null and add the ! assertion in its
declaration) since the form is initialized in ngOnInit, or alternatively add a
null-guard at the start of submit() (e.g., if (!this.loanOriginatorForm)
return;), ensuring submit() and any other methods (like in submit()) never
access this.loanOriginatorForm when it's null; update the declaration and/or
guard in the submit() method accordingly (references: loanOriginatorForm,
ngOnInit, submit()).
🧹 Nitpick comments (1)
src/app/organization/loan-originators/edit-loan-originator/edit-loan-originator.component.ts (1)

51-58: Consider moving route data subscription out of the constructor.

Subscribing to route data in the constructor works but is not the idiomatic Angular pattern. More importantly, this subscription is never unsubscribed, which is a minor memory leak if the component is destroyed and recreated. Consider using takeUntilDestroyed() (available since Angular 16) or moving to ngOnInit with a DestroyRef.


/** Loan Originator form. */
loanOriginatorForm: UntypedFormGroup;
loanOriginatorForm: UntypedFormGroup | null = null;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Nullable loanOriginatorForm accessed without null guard in submit().

Making the form UntypedFormGroup | null on Line 38 but accessing this.loanOriginatorForm.value on Line 104 without a null check is inconsistent and will fail with strict null checks or cause an NPE if submit() is ever called before initialization.

Either add a guard in submit() or use the definite assignment assertion (!) since the form is always initialized in ngOnInit:

Option A (preferred): Use definite assignment instead of nullable
-  loanOriginatorForm: UntypedFormGroup | null = null;
+  loanOriginatorForm!: UntypedFormGroup;
Option B: Add null guard in submit()
  submit() {
+   if (!this.loanOriginatorForm) return;
    const loanOriginatorFormData = this.loanOriginatorForm.value;

As per coding guidelines, src/app/**: "verify … strict type safety".

Also applies to: 104-104

🤖 Prompt for AI Agents
In
`@src/app/organization/loan-originators/edit-loan-originator/edit-loan-originator.component.ts`
at line 38, The field loanOriginatorForm is declared as Nullable but submit()
directly accesses this.loanOriginatorForm.value; change loanOriginatorForm to
use definite assignment (remove | null and add the ! assertion in its
declaration) since the form is initialized in ngOnInit, or alternatively add a
null-guard at the start of submit() (e.g., if (!this.loanOriginatorForm)
return;), ensuring submit() and any other methods (like in submit()) never
access this.loanOriginatorForm when it's null; update the declaration and/or
guard in the submit() method accordingly (references: loanOriginatorForm,
ngOnInit, submit()).

Copy link
Collaborator

@adamsaghy adamsaghy 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 aa223e7 into openMF:dev Feb 9, 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