Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NgrxLet animationFrameScheduler can stop working #3591

Closed
2 tasks
SebastianPodgajny opened this issue Sep 29, 2022 · 0 comments · Fixed by #3592
Closed
2 tasks

NgrxLet animationFrameScheduler can stop working #3591

SebastianPodgajny opened this issue Sep 29, 2022 · 0 comments · Fixed by #3592

Comments

@SebastianPodgajny
Copy link
Contributor

SebastianPodgajny commented Sep 29, 2022

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

component

Minimal reproduction of the bug/regression with instructions

Looks like animationFrameScheduler can stop working ReactiveX/rxjs#7018 because of this appRef.tick() is not called and view is not refreshed

Workaround is to use patch that will swap animationFrameScheduler with asyncScheduler

diff --git a/node_modules/@ngrx/component/fesm2020/ngrx-component.mjs b/node_modules/@ngrx/component/fesm2020/ngrx-component.mjs
index 4de7471..ce90bcf 100644
--- a/node_modules/@ngrx/component/fesm2020/ngrx-component.mjs
+++ b/node_modules/@ngrx/component/fesm2020/ngrx-component.mjs
@@ -1,6 +1,6 @@
 import * as i0 from '@angular/core';
 import { NgZone, inject, Injectable, ChangeDetectorRef, Directive, Input, NgModule, Pipe } from '@angular/core';
-import { animationFrameScheduler, isObservable, from, Observable, ReplaySubject, pipe, Subscription } from 'rxjs';
+import { animationFrameScheduler, isObservable, from, Observable, ReplaySubject, pipe, Subscription, asyncScheduler } from 'rxjs';
 import { distinctUntilChanged, switchMap, tap } from 'rxjs/operators';
 
 function isNgZone(zone) {
@@ -37,7 +37,7 @@ class AnimationFrameTickScheduler extends TickScheduler {
     schedule() {
         if (!this.isScheduled) {
             this.isScheduled = true;
-            animationFrameScheduler.schedule(() => {
+            asyncScheduler.schedule(() => {
                 this.appRef.tick();
                 this.isScheduled = false;
             });

Another workaround could be:
{ provide TickScheduler, useClass: CustomAsyncScheduler } but TickScheduler is not exported

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

Angular CLI: 14.2.0
Node: 16.16.0
Angular: 14.2.1
rxjs: 7.5.7
typescript: 4.8.2
@ngrx/component: 14.3.1

Other information

No response

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

  • Yes
  • No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants