diff --git a/client/package.json b/client/package.json index 572428b2b..02ca8cce0 100644 --- a/client/package.json +++ b/client/package.json @@ -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" diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index e164aa275..2054622c8 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -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()); } /**