Reenable Service Worker

Fixes a regression that was preventing the service worker from loading
This commit is contained in:
Sean Engelhardt 2019-12-17 10:00:57 +01:00
parent f7e4be929c
commit ff271748d7
2 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "OpenSlides3-Client",
"version": "3.0.0-alpha",
"version": "3.1.1",
"repository": {
"type": "git",
"url": "git://github.com/OpenSlides/OpenSlides.git"

View File

@ -1,7 +1,8 @@
import { Component } from '@angular/core';
import { ApplicationRef, Component } from '@angular/core';
import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { filter, take } from 'rxjs/operators';
import { ConfigService } from './core/ui-services/config.service';
import { ConstantsService } from './core/core-services/constants.service';
@ -64,6 +65,7 @@ export class AppComponent {
*/
public constructor(
translate: TranslateService,
appRef: ApplicationRef,
servertimeService: ServertimeService,
router: Router,
operator: OperatorService,
@ -93,7 +95,15 @@ export class AppComponent {
this.overloadFlatMap();
this.overloadModulo();
servertimeService.startScheduler();
// Wait until the App reaches a stable state.
// Required for the Service Worker.
appRef.isStable
.pipe(
// take only the stable state
filter(s => s),
take(1)
)
.subscribe(() => servertimeService.startScheduler());
}
/**