Correctly cache server translations
authorChocobozzz <me@florianbigard.com>
Thu, 16 Aug 2018 09:57:01 +0000 (11:57 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 27 Aug 2018 07:41:54 +0000 (09:41 +0200)
client/src/app/core/server/server.service.ts

index 6d886d2ddd85717f691c7dcf70cd8c59a18995d6..7823fa80e0e85c5fbc88af74ae61ca4887f7736d 100644 (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 { 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) {