-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
componentWillReceiveProps called only once #2646
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
Closing the issue because it's designed so. |
@luckyadam 请问这个问题官方有答复吗,在官方 react 和 redux 的使用中,每次 dispatch 都会触发 |
监听props change 就没有好的方案吗 在componentDidUpdate 发现 prevProps 和this.props 是否相等也是随机的,就没有好的解决办法吗? |
这个是taro的设计如此还是留下来的问题。(如果设计如此,也应该在官方文档中指出把) |
问题描述
[问题描述:站在其它人的角度尽可能清晰地、简洁地把问题描述清楚]
componentWillReceiveProps will be called only once if
dispatch
is called multiple times on the same phase of the event loop (Assuming the component's props derived from redux store would be changed in thedispatch
calls.).复现步骤
[复现问题的步骤]
期望行为
There should be two
console.log
outputs..报错信息
It has only one
console.log
output.系统信息
Taro CLI 1.2.22 environment info:
System:
OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 10.15.1 - /usr/bin/node
Yarn: 1.13.0 - /usr/bin/yarn
npm: 6.4.1 - /usr/bin/npm
npmPackages:
@tarojs/async-await: 1.2.22 => 1.2.22
@tarojs/components: 1.2.22 => 1.2.22
@tarojs/plugin-babel: 1.2.22 => 1.2.22
@tarojs/plugin-csso: 1.2.22 => 1.2.22
@tarojs/plugin-uglifyjs: 1.2.22 => 1.2.22
@tarojs/redux: 1.2.22 => 1.2.22
@tarojs/redux-h5: 1.2.22 => 1.2.22
@tarojs/router: 1.2.22 => 1.2.22
@tarojs/taro: 1.2.22 => 1.2.22
@tarojs/taro-alipay: 1.2.22 => 1.2.22
@tarojs/taro-h5: 1.2.22 => 1.2.22
@tarojs/taro-swan: 1.2.22 => 1.2.22
@tarojs/taro-tt: 1.2.22 => 1.2.22
@tarojs/taro-weapp: 1.2.22 => 1.2.22
@tarojs/webpack-runner: 1.2.22 => 1.2.22
eslint-config-taro: 1.2.22 => 1.2.22
eslint-plugin-taro: 1.2.22 => 1.2.22
nervjs: ^1.3.9 => 1.3.13
补充信息
[可选]
If
dispatch
is called multiple times on the same phase of the event loop. The component will be enqueued(enqueueRender
) multiple times but the first callback then deletesthis._unsafeCallUpdate
, socomponent._unsafeCallUpdate === true
will be false on next update in the current update queue.The text was updated successfully, but these errors were encountered: