Skip to content

Commit 6a35e8b

Browse files
committed
[CST-15549] Fix error with search page blocked during SSR
1 parent de19cb0 commit 6a35e8b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/app/shared/loading/loading.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
1+
import { ChangeDetectorRef, Component, Inject, Input, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
22

33
import { TranslateService } from '@ngx-translate/core';
44

55
import { hasValue } from '../empty.util';
66
import { environment } from '../../../environments/environment';
77
import { AlertType } from '../alert/alert-type';
88
import { Router } from '@angular/router';
9-
import { Location } from '@angular/common';
9+
import { isPlatformBrowser, Location } from '@angular/common';
1010

1111
enum MessageType {
1212
LOADING = 'loading',
@@ -33,7 +33,6 @@ export class LoadingComponent implements OnDestroy, OnInit {
3333
@Input() errorMessageDelay = environment.loader.errorMessageDelay;
3434
errorTimeoutWithRetriesDelay = environment.loader.errorMessageDelay;
3535

36-
3736
@Input() numberOfAutomaticPageReloads = environment.loader.numberOfAutomaticPageReloads || 0;
3837

3938
/**
@@ -52,6 +51,7 @@ export class LoadingComponent implements OnDestroy, OnInit {
5251
readonly AlertTypeEnum = AlertType;
5352

5453
constructor(
54+
@Inject(PLATFORM_ID) public platformId: any,
5555
private router: Router,
5656
private location: Location,
5757
private translate: TranslateService,
@@ -77,7 +77,7 @@ export class LoadingComponent implements OnDestroy, OnInit {
7777
this.message = this.message || this.translate.instant('loading.default');
7878
}
7979

80-
if (this.showFallbackMessages) {
80+
if (this.showFallbackMessages && isPlatformBrowser(this.platformId)) {
8181
this.warningMessage = this.warningMessage || this.translate.instant('loading.warning');
8282
this.errorMessage = this.errorMessage || this.translate.instant('loading.error');
8383

0 commit comments

Comments
 (0)