During work on v1, we made several breaking changes
- errors thrown during put execution are no longer caught and swallowed, you need to catch them manually
- removed some deprecated APIs -
takeEvery
,takeLatest
,throttle
from the redux-saga entry point (they are and were importable fromredux-saga/effects
).put.sync
andtakem
were removed. - removing execution of an array of effects
yield [...]
. useall
effect instead. delay
became an effect, olddelay
function (not effect!) can be imported from@redux-saga/delay-p
put.resolve
was changed toputResolve
take.maybe
was changed totakeMaybe
- changed API of runSaga - it no longer accepts subscribe option, you should create a channel (preferably stdChannel), pass it as channel argument to the runSaga API and communicate with through it with
take
andput
methods task.done
getter was changed to betask.toPromise
method- channels private getters (takers and closed) got removed
{effects, utils}
aren't imported from 'redux-saga' anymore. imports them fromredux-saga/effects
,redux-saga/utils
is
helper should be imported from@redux-saga/is
.- now
race
should be finished if any of effects resolved withEND
(by analogy with all) - cancel and join cannot receive variadic arguments anymore. so you have to rewrite
cancel(...[tasks])
andjoin(...[tasks])
tocancel([tasks])
andjoin([tasks])
respectively. also callingcancel(...)
returns a cancel-effect (before it may return anall
effect), and callingjoin(...)
returns a join-effect. - refactor effect structure from
{[IO]: true, [type]: payload }
to{ [IO]: true, type, payload }
to get rid of dynamictype
property. Could affect you if implement custom monitor for saga effects. - channel and actionChannel have default buffer of buffers.expanding()
- eventChannel does no longer accept matcher argument.
- exported util of
arrayOfDeffered
got renamed to the correctarrayOfDeferred
- multicastChannel - no buffering, notify all pending takers, multicastChannel#take(cb, matcher = matchers.wildcard)
- support for
yield take(multicastChannel, pattern)
- internal stdChannel got reworked to be a singleton object (it is wrapped multicastChannel's instance'), also it is an exported API to support new runSaga's signature - this should also result in being a small perf boost
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 afterdelayLength
milliseconds, if a number of attempts <maxTries
parameter- add
debounce
helper. Spawns asaga
on an action dispatched to the Store that matchespattern
. Saga will be called after it stops takingpattern
actions forms
milliseconds. Purpose of this is to prevent calling saga until the actions are settled off.