From: Chocobozzz Date: Thu, 16 Aug 2018 09:57:01 +0000 (+0200) Subject: Correctly cache server translations X-Git-Tag: v1.0.0-beta.12~117 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4bda2e47bbc937c401ddcf14c1be53c70481a294;p=oweals%2Fpeertube.git Correctly cache server translations --- diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 6d886d2dd..7823fa80e 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -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 { Inject, Injectable, LOCALE_ID } from '@angular/core' import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' @@ -178,13 +178,13 @@ export class ServerService { // Default locale, nothing to translate if (isDefaultLocale(completeLocale)) { - this.localeObservable = of({}).pipe(share()) + this.localeObservable = of({}).pipe(shareReplay()) return } this.localeObservable = this.http .get(ServerService.BASE_LOCALE_URL + completeLocale + '/server.json') - .pipe(share()) + .pipe(shareReplay()) } private saveConfigLocally (config: ServerConfig) {