redux-saga-caller
v1.0.5
Published
Prevent calling redux sagas twice with same params in parallel.
Downloads
16
Readme
Redux Saga Caller - Call Sagas Once Per Params
Easy way how to prevent calling Redux Sagas twice with same params in parallel.
Once saga with same parameter finish, library will stop ignoring new requests.
Tiny library - only 1KB minified!
Note: Require redux-saga
dependency installed in your project.
Usage API
Install npm i redux-saga-caller
callOncePerParams(customIdentifier, sagaFunctionWithParams)
...having:
- identifier: string / array of string to uniquely identify your action
- sagaFunctionWithParams: array with saga function name and it's params (same as official saga call params)
To get all running tasks identifiers (JavaScript Set
) use method getRunning
.
Example
import { callOncePerParams } from 'redux-saga-caller';
// Somewhere in your Redux Saga...
yield callOncePerParams(
['FETCH_ARTICLES', 'ASC', 10],
[fetchArticlesSaga, { order: 'ASC', limit: 10}]
);
See and run src/index.test.js
to fully understand library.
Enjoy :relaxed:
Please give project :star: if you like it!