Breaking changes:
channel
andactionChannel
have default buffer ofbuffers.expanding()
- errors thrown during
put
execution are no longer caught and swallowed, you need to catch them manually - signature of join & cancel, they both accept now a single task descriptor or an array of those (previously they have accepted variadic length of arguments)
- removed some deprecated APIs -
takeEvery
,takeLatest
,throttle
from theredux-saga
entry point (they are and were importable fromredux-saga/effects
),takem
,put.sync
and executing array of effects, there is explicit API for this for already some time -all
effect - changed API of
runSaga
- it no longer acceptssubscribe
option, you should create a channel (preferablystdChannel
), pass it aschannel
argument to therunSaga
API and communicate with through it withtake
andput
methods - refactored shape of the effect objects to
{ [IO]: true, type, payload }
- removed
asEffect
, effect types are public, effect shapes are stable, so if for whatever reason you want to do some effect inspection you can just check them without us providing additional helpers for it - removed
logError
, use onlyonError
option (it's signature isonError(error, { sagaStack })
) END
will now finish therace
effectstask.done
getter was changed to betask.toPromise
methodchannel
s private getters (__takers__
and__closed__
) got removeddelay
became an effectredux-saga/utils
got removed, exports available exclusively there got moved to separate packages -@redux-saga/deferred
,@redux-saga/delay-p
,@redux-saga/is
,@redux-saga/symbols
&@redux-saga/testing-utils
eventChannel
does no longer acceptmatcher
argument - it was a hacky way to support previous implementation ofstdChannel
{effects, utils}
can't imported from 'redux-saga' anymore- most runtime type checks got hidden behing development checks, inputs might not be validated in production (failed validation resulted in error being thrown anyway)
detach
helper returns a new effect instead of mutating the input one- we have stopped interpreting effects returned from
fork
, this shouldn't affect any real-life code, affected patterns look like thisfork(() => effectCreator())
andfork(takeEvery, 'type', fn)
- TS typings got revamped - they require
TS@>3.1
now
New:
babel-plugin-redux-saga
- can be used to enhance stack traces of thrown errorsmulticastChannel
- no buffering, notify all pending takers,multicastChannel#take(cb, matcher = matchers.wildard)
- support for
yield take(multicastChannel, pattern)
- internal
stdChannel
got reworked to be a singleton object (it is wrappedmulticastChannel
's instance'), also it is an exported API to support newrunSaga
'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 beingredux-saga
itself). How it might be used can be checked here.takeLeading
effect - it takes "leading" action and ignores all incoming ones of the same type while the "leading" is still handled (useful for things debouncing)retry
effect with the signature ofretry(maxTries, delayLength, worker, ...args)
debounce
effect with the signature ofdebounce(delayLength, pattern, worker, ...args)
- new
rootSagaStarted
hook for saga monitor - added dev warning about dispatching frozen actions, for scheduling purposes we are using
Object.defineProperty
on actions dispatched withput
effect, so we have to be able to mutate the action object - added dev warning about using async generators, they are not supported by
redux-saga
- CommonJS entries are proxied now. This means that
process.env.NODE_ENV
is read only once and based on that value the appropriate bundle (development or production) is loaded conditionally withrequire
.process.env
is slow in node.js so this should improve performance a little bit. isRoot
property on Task (you probably won't ever need to use it, it's internal)
Fixes:
- keeping single
stdChannel
in the internals allowed to fix 2 bugs with missed actions (see #707 and #1146) onError
should get called now even if you throw non-Errors in your code.- we suspend the scheduler before running a root saga, so it should behave the same as forked sagas in terms of scheduling
- small memory leak for closed
actionChannel
s - issue with joiner not ending in cancelled state when joining cancelled task