redux-saga-beginner-tutorial
redux-saga-beginner-tutorial copied to clipboard
TypeError: (0 , _utils.delay) is not a function
I followed the tutorial to add asynchronous calls. However, I got this error in browser console,
at rootSaga
at takeEvery
at incrementAsync
TypeError: (0 , _utils.delay) is not a function
at incrementAsync$ (http://9.181.95.220:9966/build.js:31683:35)
at tryCatch (http://9.181.95.220:9966/build.js:221:40)
at Generator.invoke [as _invoke] (http://9.181.95.220:9966/build.js:459:22)
at Generator.prototype.(anonymous function) [as next] (http://9.181.95.220:9966/build.js:273:21)
at next (http://9.181.95.220:9966/build.js:29398:27)
at proc (http://9.181.95.220:9966/build.js:29350:3)
at runForkEffect (http://9.181.95.220:9966/build.js:29696:19)
at runEffect (http://9.181.95.220:9966/build.js:29476:472)
at digestEffect (http://9.181.95.220:9966/build.js:29555:5)
I figured out that in sagas.js
, it should be import { delay } from 'redux-saga'
, instead of import { delay } from 'redux-saga/utils'
. But from https://github.com/redux-saga/redux-saga/pull/1401, delay
is either in redux-saga/utils
or redux-saga/effects
, what is expected place to import delay
?
Any updates on this?
My fault, it looks like this was added to CHANGELOG in redux-saga repo:
delay
became an effect
, old delay
function (not effect!) can be imported from @redux-saga/delay-p
Hi I'm getting the same error with delay following this: https://github.com/redux-saga/redux-saga/blob/master/docs/advanced/RacingEffects.md
If I comment out the delay line it doesn't error.
const { data } = yield race({
data: take(APP_ACTIONS.APP_FETCH_ENTITLEMENTS_SUCCEEDED),
timeout: delay(5000),
});
Edit: Fixed by using delay from import { delay } from 'redux-saga'
instead - seems this is incorrect in multiple places in the docs?
@DominicTobias Yeah the docs are definitely wrong on this one. Thanks for the save.
If you could pinpoint places where this is referenced wrong in the docs it would be appreciated, keep in mind that docs are about v1 which differs slightly from 0.x
Using version "^1.0.1", and having the same issue as @DominicTobias . Work by by using delay from import { delay } from 'redux-saga'
however does not work from import {delay} from 'redux-saga/effects