[英]NextJS redux-saga sample code doesn't work with redux-saga ^1.0.0?
I'm working on connecting Next.js and redux-saga in a large existing React project. 我正在一个大型的现有React项目中连接Next.js和redux-saga。 I am following the Next.js sample code for this.
我正在遵循Next.js示例代码。 The sample code works fine, but when I tried to move the Next.js redux-saga sample code -- https://github.com/zeit/next.js/tree/master/examples/with-redux-saga --, my data wasn't getting stored in the store.
示例代码可以正常工作,但是当我尝试移动Next.js redux-saga示例代码时-https: //github.com/zeit/next.js/tree/master/examples/with-redux-saga- ,我的数据没有存储在商店中。 I'm not sure if my action to store it is being called, or if it's being called late, but I end up with an empty store.
我不确定是否要调用我的存储操作,还是晚调用该存储,但最终还是空了存储。
I was tracing through the output and saw that the redux-saga task seems to have a done
field with the sample code, but with my code it has a toPromise
field. 我正在跟踪输出,发现redux-saga任务似乎带有示例代码的
done
字段,但是对于我的代码,它具有toPromise
字段。
The only obvious difference I could see between the two projects was that the sample code uses redux-saga 0.16.0 and my project uses ^1.0.0. 我在两个项目之间可以看到的唯一明显区别是,示例代码使用redux-saga 0.16.0,而我的项目使用^ 1.0.0。
When I switched my project to use redux-saga 0.16.0 it works fine. 当我切换项目以使用redux-saga 0.16.0时,它可以正常工作。
Perhaps next-redux-saga, on which both of these projects depends, is looking for the done
field? 这两个项目所依赖的next-redux-saga可能正在寻找
done
领域? Could it be something else? 可能还有其他吗? I attach the two package.json fields, in case you spot something I didn't.
我附加了两个package.json字段,以防您发现我没有的东西。 Thanks for any help!
谢谢你的帮助!
Sample code package.json 示例代码package.json
{
"name": "with-redux-saga",
"version": "1.0.0",
"license": "ISC",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"es6-promise": "4.1.1",
"isomorphic-unfetch": "2.0.0",
"next": "^7.0.2",
"next-redux-saga": "3.0.0",
"next-redux-wrapper": "2.0.0",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-redux": "5.0.7",
"redux": "4.0.0",
"redux-saga": "^1.0.0"
},
"devDependencies": {
"redux-devtools-extension": "2.13.2"
}
}
My package.json 我的package.json
{
"name": "PAW-React",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/InterficieIS/PAW-React.git",
"author": "Javier1177 <javierlopezblasco@gmail.com>",
"license": "MIT",
"dependencies": {
"@date-io/date-fns": "^1.0.1",
"@material-ui/core": "^3.8.3",
"autoprefixer": "7.1.5",
"babel-plugin-module-resolver": "^2.7.1",
"babel-plugin-wrap-in-js": "^1.1.0",
"bulma": "^0.6.2",
"date-fns": "^2.0.0-alpha.27",
"dotenv": "^4.0.0",
"eslint-config-airbnb": "^17.1.0",
"express": "^4.16.4",
"glob": "^7.1.2",
"isomorphic-unfetch": "^3.0.0",
"jss": "^9.8.7",
"material-ui-pickers": "^2.1.1",
"next": "^7.0.2",
"next-fonts": "^0.16.0",
"next-redux-saga": "^3.0.0",
"next-redux-wrapper": "^2.1.0",
"node-sass": "^4.4.0",
"normalize.css": "^7.0.0",
"prop-types": "^15.6.2",
"raw-loader": "^0.5.1",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-jss": "^8.6.1",
"react-redux": "^6.0.0",
"react-slick": "^0.23.2",
"redux": "^4.0.1",
"redux-saga": "^1.0.0",
"sass-loader": "^6.0.6",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"command-line-args": "^4.0.7",
"cross-env": "^5.1.3",
"eslint": "^5.12.0",
"eslint-config-react-app": "^2.1.0",
"eslint-plugin-flowtype": "^2.41.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.5.1",
"file-loader": "^3.0.1",
"url-loader": "^1.1.2",
"redux-devtools-extension": "^2.13.7"
},
"scripts": {
"dev": "PORT=3001 node server.js",
"build": "next build",
"start": "NODE_ENV=production node server.js",
"export": "next export",
"eslint": "eslint . --ext=\"js,jsx\""
}
}
The react-redux release 1.0.0 brings along API breaking changes which aren't yet implemented in those project. react-redux版本1.0.0带来了API重大更改,这些项目中尚未实现。 Please keep track of the following issues and pull-requests to know more:
请跟踪以下问题和请求,以了解更多信息:
https://github.com/zeit/next.js/pull/6109 https://github.com/zeit/next.js/pull/6109
https://github.com/bmealhouse/next-redux-saga/issues/27 https://github.com/bmealhouse/next-redux-saga/issues/27
https://github.com/bmealhouse/next-redux-saga/pull/29 https://github.com/bmealhouse/next-redux-saga/pull/29
Best Regards 最好的祝福
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.