Redux Saga Creator
Create a fault-tolerant root saga from an object of sagas.
Inspiration from thispost.
Features
- Creates a root saga based on an object where its values are sagas to be initiated on store creation.
- Handles sagas from crashing all other sagas
- Automatically restarts sagas that crash
Usage
;;; ; { console;} // an effect that demonstrates what happens when there is an error in a saga { console; throw 'something bad';} // testing to make sure sagas work properly { console; while true ; ; ; ; } // object that contains sagasconst sagas = onAuth { console; }; // optional: handle errors in sagasconst onError = { console; console;};// create root saga from objectconst rootSaga = ; const sagaMiddleware = ;const store = ;// pass extra data to all sagas inside objectsagaMiddleware; { store; ;} ;; /*[ 'more', 'data' ]should callloginlogouttrack saga errorsError: something bad at index.ts:12:9[ 'more', 'data' ]loginlogouttrack saga errorsError: something bad at index.ts:12:9[ 'more', 'data' ]*/