New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在effects中使用async/await做异步不起作用?要必须使用*/yield吗? #134
Comments
effects: {
}, |
是的,effect 只支持 generator 的写法。 |
了解了,谢谢大神 |
请问,effect 有机会在将来支持 async 吗? @sorrycc |
async 没有 generator 可控,比如不能 |
哦 |
@sorrycc 请问要如何cancel一个effect呢? |
@miaojiuchen 场景是啥? 为啥要 cancel effect ? |
@sorrycc 我在遇到这样的场景:
这样在一个页面没问题,但是如果访问其他页面,再返回上页面,就会重复effect 2. 谢谢。 |
@sorrycc 既然你这里也提出了什么场景需要使用cancel,事实上大多数情况下async/await足矣。目前的用法里,用 generator/yield 再去调用 async/await,这样太蛋疼了,作者可以考虑同时支持两种模式,让用户自己去选择,比如增加一个配置项,开启后调用async/await模式,或者自适应判断。 |
可以试试redva,一样的dva框架,默认开启async/await和immer |
effects: {
},
The text was updated successfully, but these errors were encountered: