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

ApplicationRef.isStable is always false when using this package #965

Merged
merged 3 commits into from Feb 13, 2021

Conversation

BillyBlaze
Copy link
Contributor

Describe the bug
When you kick-off the setup (with checkAuth) then this package will create intervals and timeouts. When using Service workers it's important to get the application into stable mode or else the new version isn't downloaded. However this is not possible because this package is making it unstable and it will never turn stable.

To Reproduce
Steps to reproduce the behavior:

  1. Add this snippet somewhere (e.g. constructor of app.module.ts):
     this.applicationRef.isStable.pipe(
     	tap(isStable => console.log(`ApplicationRef::stable`, isStable))
     ).subscribe();
  2. Initialize this package with calling checkAuth (we do it in the initializer, so that the guards are fully working with this package)
  3. Notice that in the console the message 'ApplicationRef::stable false' is recieved but you will never get 'ApplicationRef::stable true'
    • When you do have a "stable" version you should see 'ApplicationRef::stable false' and than followed up by 'ApplicationRef::stable true'

Expected behavior
intervals and timeouts should be run outside the NgZone so that it wont interfere with the "stability" of Angular.

This package reaches stable for me when these two culprits are run outside angular:


this.scheduledHeartBeatRunning = setTimeout(pollServerSessionRecur, this.heartBeatInterval);

#961

@damienbod
Copy link
Owner

@BillyBlaze Thanks for the PR. I'll go through this in the next few days, merge and release, up to my eyes in work.

Greetings Damien

@damienbod damienbod merged commit 8e3f55c into damienbod:main Feb 13, 2021
@damienbod
Copy link
Owner

damienbod commented Feb 13, 2021

@BillyBlaze Thanks works great. Will be releasing in the 11.5.1 version

Greetings Damien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants