21838: Add load favorites saga
[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 } from "./tree-picker/tree-picker-actions";
14
15 /**
16 * Auto restart sagas with error logging
17 */
18 export const rootSaga = function* () {
19    const sagas = [
20        setTreePickerProjectSearchWatcher,
21        setTreePickerCollectionFilterWatcher,
22        refreshTreePickerWatcher,
23        loadProjectWatcher,
24        loadSearchWatcher,
25        loadFavoritesProjectWatcher,
26    ];
27
28    yield all(sagas.map(saga =>
29        spawn(function* () {
30            while (true) {
31                try {
32                    yield call(saga);
33                    break;
34                } catch (e) {
35                    console.error(e);
36                }
37            }
38        }))
39    );
40 }