added retry catch to vuex current history panel syncer for pages with slow current history loads

This commit is contained in:
Mason Houtz
2021-01-19 12:14:15 +01:00
committed by mvdbeek
parent 4671419df2
commit b7de280ef3
@@ -1,9 +1,11 @@
// Sync Galaxy store to legacy galaxy current history
import { fromEvent } from "rxjs";
import { map, filter, switchMap, pluck, distinctUntilChanged } from "rxjs/operators";
import { map, filter, switchMap, pluck, distinctUntilChanged, retryWhen, take, delay } from "rxjs/operators";
export function syncCurrentHistoryToGalaxy(galaxy$, store, cfg = {}) {
const { retryPeriod = 500, retries = 20 } = cfg;
export function syncCurrentHistoryToGalaxy(galaxy$, store) {
// prettier-ignore
const historyId$ = galaxy$.pipe(
pluck("currHistoryPanel"),
@@ -14,6 +16,10 @@ export function syncCurrentHistoryToGalaxy(galaxy$, store) {
map(() => panel.model.id)
);
}),
retryWhen(err$ => err$.pipe(
delay(retryPeriod),
take(retries)
)),
filter(Boolean),
distinctUntilChanged()
);