Skip to content

Commit

Permalink
fix: forkJoin observables
Browse files Browse the repository at this point in the history
  • Loading branch information
markuczy committed Jul 15, 2024
1 parent 96578bb commit d20c0fe
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, OnDestroy } from '@angular/core'
import { Observable, filter, map, of, tap } from 'rxjs'
import { Observable, filter, first, map, of, tap } from 'rxjs'
import { SyncableTopic } from '@onecx/accelerator'

// This topic is defined here and not in integration-interface, because
Expand Down Expand Up @@ -35,17 +35,19 @@ export class TranslationCacheService implements OnDestroy {
if (window['onecxTranslations'][url] === null) {
return this.translationTopic$.pipe(
filter((messageUrl) => messageUrl === url),
map(() => window['onecxTranslations'][url])
map(() => window['onecxTranslations'][url]),
first()
)
}

window['onecxTranslations'][url] = null
return cacheMissFunction().pipe(
tap((t) => {
this.translationTopic$.publish(url)
window['onecxTranslations'][url] = t
this.translationTopic$.publish(url)
}),
map(() => window['onecxTranslations'][url])
map(() => window['onecxTranslations'][url]),
first()
)
}
}

0 comments on commit d20c0fe

Please sign in to comment.