Skip to content

Grid throws "window is not defined" during SSR in 22.2.5, 21.2.24 and 22.3.0-beta.1 #17927

Closed

Description

@simeonoff

Description

Since 22.2.5, 21.2.24 and 22.3.0-beta.1, every grid throws ReferenceError: window is not defined during server-side rendering. IgxForOfDirective._updateScrollOffset() now reads the isRTL getter, which calls window.getComputedStyle() with no platform check. For horizontal igxFor instances, which includes the column virtualization of every grid row and header, this happens in ngOnInit and resolveDataDiff, so it runs on the server. The partially initialized directives then throw TypeError: Cannot read properties of undefined (reading 'removeEventListener') in ngOnDestroy.

Regression from #17783, which was also merged to 22.2.x (#17784) and 21.2.x (#17785) and shipped in 22.2.5 and 21.2.24. 22.3.0-alpha.0 renders the same pages without these errors.

Framework

Angular with SSR (Server-Side Rendering)

Angular Version

22.2.0

Ignite UI for Angular Version

22.2.5, 21.2.24, 22.3.0-beta.1

Component / Area

Grid

Browser

Other

Operating System

macOS

Command Not Working

$ ng build
ERROR ReferenceError: window is not defined
    at get isRTL (main.server.mjs)
    at IgxGridForOfDirective._updateScrollOffset (main.server.mjs)
    at IgxGridForOfDirective.ngOnInit (main.server.mjs)
...
uncaughtException TypeError: Cannot read properties of undefined (reading 'removeEventListener')
    at ngOnDestroy (main.server.mjs)

Steps to Reproduce

  1. Create an SSR app with prerendering (ng new repro --ssr) and add igniteui-angular@22.3.0-beta.1.
  2. Render <igx-grid [data]="[{ id: 1 }]" [autoGenerate]="true"></igx-grid> in a prerendered route.
  3. Run ng build, or serve the app and request the route.

Actual Result

Server rendering logs ReferenceError: window is not defined from isRTL for each grid, followed by removeEventListener errors on destroy. The build still exits with code 0, so CI does not catch it.

Expected Result

The grid renders on the server without errors, as in 22.3.0-alpha.0. IgxForOfDirective should not access window outside the browser.

Reproduction URL

IgniteUI/igniteui-angular-samples#4069

Attachments

No response

Activity

  1. added theissue type on Nov 5, 2026
  2. self-assigned this
    on Nov 5, 2026
  3. changed the title [-]Grid throws "window is not defined" during SSR in 22.3.0-beta.1[/-] [+]Grid throws "window is not defined" during SSR in 22.2.5, 21.2.24 and 22.3.0-beta.1[/+] on Nov 5, 2026
  4. kdinev commented on Nov 5, 2026

    @kdinev
    Member

    @simeonoff Just ran into the same issue and notices you've already logged it!

  5. added 2 commits that reference this issue on Nov 5, 2026
    179f41e
    d3476be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions