Merge branch 'main' into 22159-data-explorer-refactor
[arvados.git] / services / workbench2 / src / store / redux-saga.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { call, all, spawn } from "redux-saga/effects";
6 import {
7     setTreePickerProjectSearchWatcher,
8     loadProjectWatcher,
9     loadSearchWatcher,
10     refreshTreePickerWatcher,
11     setTreePickerCollectionFilterWatcher,
12     loadFavoritesProjectWatcher,
13     loadPublicFavoritesProjectWatcher,
14 } from "./tree-picker/tree-picker-actions";
15
16 /**
17 * Auto restart sagas with error logging
18 */
19 export const rootSaga = function* () {
20    const sagas = [
21        setTreePickerProjectSearchWatcher,
22        setTreePickerCollectionFilterWatcher,
23        refreshTreePickerWatcher,
24        loadProjectWatcher,
25        loadSearchWatcher,
26        loadFavoritesProjectWatcher,
27        loadPublicFavoritesProjectWatcher,
28    ];
29
30    yield all(sagas.map(saga =>
31        spawn(function* () {
32            while (true) {
33                try {
34                    yield call(saga);
35                    break;
36                } catch (e) {
37                    console.error(e);
38                }
39            }
40        }))
41    );
42 }