Skip to content

Commit 710ced6

Browse files
committed
translation loading timeout
1 parent a281014 commit 710ced6

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

editor/src/app/app.module.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,20 @@ import { LibraryPageComponent } from './components/library-page/library-page.com
124124
import { KNOWN_LANGUAGES } from './models';
125125
import { DecisionTreeComponent } from './components/decision-tree/decision-tree.component';
126126
import { ServiceWorkerModule } from '@angular/service-worker';
127+
import { catchError, timeout } from 'rxjs/operators';
128+
import { of } from 'rxjs';
129+
130+
class CustomTranslateLoader extends TranslateHttpLoader {
131+
getTranslation(lang: string) {
132+
return super.getTranslation(lang).pipe(
133+
timeout(3000),
134+
catchError(() => of({}))
135+
);
136+
}
137+
}
127138

128139
export function HttpLoaderFactory(http: HttpClient) {
129-
return new TranslateHttpLoader(http);
140+
return new CustomTranslateLoader(http);
130141
}
131142

132143
export function loadTranslations(

0 commit comments

Comments
 (0)