redux-saga
See our website for more information.
Saga middleware for Redux to handle Side Effects
See our website for more information.
During work on v1, we made several breaking changes
finally
block fail-safetakeEvery
, takeLatest
, throttle
from the redux-saga entry point (they are and were importable from redux-saga/effects
). put.sync
and takem
were removed.yield [...]
. use all
effect instead.delay
became an effect, old delay
function (not effect!) can be imported from @redux-saga/delay-p
put.resolve
was changed to putResolve
take.maybe
was changed to takeMaybe
take
and put
methodstask.done
getter was changed to be task.toPromise
methodonError
doesn't extend error
with additional field sagaStack
, but pass it as a property of second argument. before: onError: (e: Error)
, after: onError(e: Error, { sagaStack })
Effect
shape, yielded to redux-saga middleware, is stabilized and declared now as a plain JavaScript object{effects, utils}
aren't imported from 'redux-saga' anymore. imports them from redux-saga/effects
, redux-saga/utils
is
helper should be imported from @redux-saga/is
.createMockTask
, cloneableGenerator
should be imported from @redux-saga/testing-utils
race
should be finished if any of effects resolved with END
(by analogy with all)cancel(...[tasks])
and join(...[tasks])
to cancel([tasks])
and join([tasks])
respectively. also calling cancel(...)
returns a cancel-effect (before it may return an all
effect), and calling join(...)
returns a join-effect.{[IO]: true, [type]: payload }
to { [IO]: true, type, payload }
to get rid of dynamic type
property. Could affect you if implement custom monitor for saga effects.arrayOfDeffered
got renamed to the correct arrayOfDeferred
yield take(multicastChannel, pattern)
effectMiddlewares
- useful especially for testing, you can intercept/hijack any effect and resolve it on your own - passing it very redux-style to the next middleware (last being redux-saga itself). How it might be used can be checked here. Many thanks to @eloytoro for this featuretakeLeading
helper. It takes "leading" action and ignores all incoming ones of the same type while the "leading" is still handled (useful for things debouncing)retry
helper. Receives a function and executes it (with blocking call). In case of failure will try to make another call after delayLength
milliseconds, if a number of attempts < maxTries
parameterdebounce
helper. Spawns a saga
on an action dispatched to the Store that matches pattern
. Saga will be called after it stops taking pattern
actions for ms
milliseconds. Purpose of this is to prevent calling saga until the actions are settled off.