Correctly cache server translations

pull/974/head
Chocobozzz 2018-08-16 11:57:01 +02:00
parent c0ffdd0958
commit 4bda2e47bb
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import { map, share, switchMap, tap } from 'rxjs/operators' import { map, shareReplay, switchMap, tap } from 'rxjs/operators'
import { HttpClient } from '@angular/common/http' import { HttpClient } from '@angular/common/http'
import { Inject, Injectable, LOCALE_ID } from '@angular/core' import { Inject, Injectable, LOCALE_ID } from '@angular/core'
import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
@ -178,13 +178,13 @@ export class ServerService {
// Default locale, nothing to translate // Default locale, nothing to translate
if (isDefaultLocale(completeLocale)) { if (isDefaultLocale(completeLocale)) {
this.localeObservable = of({}).pipe(share()) this.localeObservable = of({}).pipe(shareReplay())
return return
} }
this.localeObservable = this.http this.localeObservable = this.http
.get(ServerService.BASE_LOCALE_URL + completeLocale + '/server.json') .get(ServerService.BASE_LOCALE_URL + completeLocale + '/server.json')
.pipe(share()) .pipe(shareReplay())
} }
private saveConfigLocally (config: ServerConfig) { private saveConfigLocally (config: ServerConfig) {