Skip to content

refactor: stop relying on null from template safe navigation - #3631

Merged
rsdmike merged 2 commits into
mainfrom
refactor/template-safe-navigation
Oct 13, 2026
Merged

rsdmike merged 2 commits into
mainfrom
refactor/template-safe-navigation

Conversation

@rsdmike

@rsdmike rsdmike commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Angular 22 makes ?. in templates evaluate to undefined, as it does in JavaScript, where earlier versions produced null.

The disk size formatter treats a missing size as zero, so it keeps printing "0 GB" where undefined would give "NaN GB". The profile form reads the CIRA config control directly when checking for null instead of going through an optional chain.

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

Anything the reviewer should know when reviewing this PR?

If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new undefined-size fallback lacks a focused regression test.

1 open finding
What changed in this PR

Updates template behavior for Angular 22’s undefined safe-navigation semantics.

Changes:

  • Defaults missing disk sizes to zero.
  • Accesses the typed CIRA form control directly.
File Description
profile-detail.component.html Removes unnecessary safe navigation for the CIRA control.
hardware-information.component.ts Handles missing media sizes without producing NaN GB.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rsdmike
rsdmike force-pushed the refactor/template-safe-navigation branch from db3258d to 94ea97c Compare October 13, 2026 15:29
Base automatically changed from refactor/template-state-signals to main October 13, 2026 15:36
Angular 22 makes `?.` in templates evaluate to undefined, as it does
in JavaScript, where earlier versions produced null.

The disk size formatter treats a missing size as zero, so it keeps
printing "0 GB" where undefined would give "NaN GB". The profile form
reads the CIRA config control directly when checking for null instead
of going through an optional chain.
calculateMediaSize falls back to zero when the template's optional
chain yields undefined, so assert that it returns "0 GB" for it.
@rsdmike
rsdmike force-pushed the refactor/template-safe-navigation branch from 94ea97c to f6c78d6 Compare October 13, 2026 15:36
@rsdmike
rsdmike merged commit 383cc2d into main Oct 13, 2026
10 checks passed
@rsdmike
rsdmike deleted the refactor/template-safe-navigation branch October 13, 2026 15:44
@RosieAMT

Copy link
Copy Markdown

🎉 This PR is included in version 3.70.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@RosieAMT

Copy link
Copy Markdown

🎉 This PR is included in version 3.70.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@graikhel-intel graikhel-intel linked an issue Oct 22, 2026 that may be closed by this pull request
5 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade sample-web-ui from Angular 21 to Angular 22

4 participants