Skip to content

fix(combo): declare the item window @let outside the drop-down - #17645

Open
viktorkombov wants to merge 2 commits into
masterfrom
vkombov/combo-let-ssr-serialization
Open

viktorkombov wants to merge 2 commits into
masterfrom
vkombov/combo-let-ssr-serialization

Conversation

@viktorkombov

Copy link
Copy Markdown
Contributor

Closes #17644

Description

Moves the combo's @let itemWindow declaration out of the drop-down content and in front of <igx-combo-drop-down>, so a combo can be prerendered again.

The drop-down projects its content behind @if (!collapsed), so while the combo is closed that content is not in the server DOM. Angular serializes a @let by recording a DOM path to its next sibling, which inside the drop-down is that detached content, and serialization fails with NG0502. igx-simple-combo already declared its @let outside the drop-down, so this aligns the two.

Both positions belong to the same declaring view, so the scope of itemWindow, the pipes feeding it and every consumer are unchanged.

Motivation / Context

Regressed in 22.2.0-rc.0, when the combo list moved from igxFor to IgxVirtualScrollComponent and gained the @let. Any prerendered route containing a combo now fails the build, directly or through the Query Builder, which uses a combo internally:

X [ERROR] An error occurred while prerendering route '/interactions/query-builder-sample-1'.
Error: NG0502: During serialization, Angular was unable to find an element in the DOM:
<div class="igx-combo"> … #node(@let) … <-- AT THIS LOCATION

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

Combo, Simple Combo, SSR/hydration, CI

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Adds scripts/ssr/hydration.spec.mjs, run by npm run test:ssr and wired into the Test step of nodejs.yml after Build Lib. It renders both combos through @angular/platform-server with server rendering and hydration enabled, then asserts the output carries hydration annotations, serialized hydration state and a drop-down rendered closed. It takes about 1.5s against dist/.

Check Result
npm run test:ssr 2 passed
Same suite with the @let moved back igx-combo fails with NG0502, igx-simple-combo still passes
Same suite without provideServerRendering() both fail on the serialized-state assertion
Combo unit tests 170 passed
igniteui-angular-samples production build 283 routes prerendered, 0 NG0502, previously 7 failing routes
Manual prerendered page hydrates with no hydration errors and clears every ngh marker; both combos then open, filter and select

Test Configuration:

  • Angular version: 22.1.7
  • Browser(s): Chrome 153 headless
  • OS: Windows 11, CI on ubuntu-latest

Screenshots / Recordings

n/a, no visual change.

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code
  • This PR includes API docs for newly added methods/properties
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

No changelog entry: this fixes an unreleased change already described under Unreleased. No public API, DOM structure or styling changes.

viktorkombov and others added 2 commits September 21, 2026 20:35
The drop-down projects its content behind `@if (!collapsed)`, so while the
combo is closed that content is not in the server DOM. Angular serializes a
@let by recording a DOM path to its next sibling, which inside the drop-down
is that detached content, so prerendering a route with a combo failed with
NG0502. Simple combo already declared its @let outside the drop-down.

Both placements belong to the same declaring view, so the scope of
itemWindow, the pipes feeding it and every consumer are unchanged.

Adds scripts/ssr/hydration.spec.mjs, run by `npm run test:ssr` and wired
into the CI test step. It renders both combos through platform-server with
hydration enabled and asserts the output serializes with the drop-down
closed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The project declared RenderMode.Prerender but its build was missing
outputMode "static", so it reported "Prerendered 0 static routes" and never
rendered a page. Enabling it surfaced a second latent break: server.ts
registered the catch-all as the Express 4 style app.use('/**', ...), which
Express 5 rejects with "Missing parameter name at index 2".

With both fixed the project prerenders all 9 routes. The new /combo route
renders igx-combo and igx-simple-combo, covering hydration serialization
through the full AOT and prerender path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

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.

Copilot review overview

🟡 Changes recommended

The SSR test imports provideServerRendering from the wrong package, causing npm run test:ssr to fail before tests run.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes SSR hydration failures by moving itemWindow outside detached combo drop-down content and adding regression coverage.

Changes:

  • Relocates the @let itemWindow declaration.
  • Adds SSR hydration tests and bundle-test coverage.
  • Integrates SSR testing into CI.
File Changes
scripts/​ssr/​hydration.spec.mjs Adds SSR hydration tests; its provideServerRendering import must be corrected.
projects/​igniteui-angular/​combo/​src/​combo/​combo.component.html Moves itemWindow outside the drop-down.
projects/​bundle-test/​src/​app/​combo/​combo.component.ts Adds the combo bundle-test component.
projects/​bundle-test/​src/​app/​combo/​combo.component.scss Adds combo test styling.
projects/​bundle-test/​src/​app/​combo/​combo.component.html Renders combo test cases.
projects/​bundle-test/​src/​app/​app.routes.ts Registers the combo route.
projects/​bundle-test/​server.ts Updates SSR request handling.
package.json Adds the SSR test command.
angular.json Enables static output.
.github/​workflows/​nodejs.yml Runs SSR tests in CI.

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

Comment thread scripts/ssr/hydration.spec.mjs

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Combo] combo and simple combo fail to prerender with NG0502 in 22.2.0-rc.0

3 participants