From b7de280ef31a3f15c06d452bfaebd02197bff11b Mon Sep 17 00:00:00 2001 From: Mason Houtz Date: Mon, 18 Jan 2021 11:37:19 -0800 Subject: [PATCH] added retry catch to vuex current history panel syncer for pages with slow current history loads --- .../History/model/syncCurrentHistoryToGalaxy.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/components/History/model/syncCurrentHistoryToGalaxy.js b/client/src/components/History/model/syncCurrentHistoryToGalaxy.js index be7ce846c14..a161e981428 100644 --- a/client/src/components/History/model/syncCurrentHistoryToGalaxy.js +++ b/client/src/components/History/model/syncCurrentHistoryToGalaxy.js @@ -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() );