Skip to content

@ngrx/component: Illegal invocation error #5108

@hakimio

Description

@hakimio

Which @ngrx/* package(s) are the source of the bug?

component

Minimal reproduction of the bug/regression with instructions

The error was introduce in #4912 .
The issue is that requestAnimationFrame is extracted and called without [window] context/receiver here.
The function needs to either be bound to window or scheduleFn should be converted to an arrow function:

scheduleFn = (callback: FrameRequestCallback) => this.isServer ? setTimeout(callback) : requestAnimationFrame(callback);

Expected behavior

There shouldn't be any TypeError: Illegal invocation browser errors and the CD should be scheduled correctly.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

Ngrx: 21.0.1
Angular: 21.2
Node: v22.16.0
Browser: Chrome 145
OS: Windows 11

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions