Skip to content
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

component.$scope.setData( dataDiff, cb)引起的数据异常 #4344

Closed
zzyhdu opened this issue Aug 30, 2019 · 5 comments
Closed

component.$scope.setData( dataDiff, cb)引起的数据异常 #4344

zzyhdu opened this issue Aug 30, 2019 · 5 comments
Assignees

Comments

@zzyhdu
Copy link

zzyhdu commented Aug 30, 2019

问题描述
本问题是接https://github.com/NervJS/taro/issues/3927的,通过log发现在component.$scope.setData( dataDiff, cb)运行过后,component的props出现异常。

复现步骤

[复现问题的步骤]
数据源来自websocket,收到event之后更新magnet,redux以数组的形式存放magnet
一下提供了去掉setData和未去掉的对比

image
image
image
image

期望行为
数据正确。希望提供解题思路

系统信息

image

补充信息

@taro-bot
Copy link

taro-bot bot commented Aug 30, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@zzyhdu
Copy link
Author

zzyhdu commented Aug 30, 2019

ps,在去掉setData时候的log
image

@John251314
Copy link

遇到了同样的问题,使用redux管理数据,在更新数据之后,追踪到doUpdate后数据异常,坑死了

@taro-bot
Copy link

taro-bot bot commented Sep 2, 2019

CC @Chen-jj

@Chen-jj
Copy link
Contributor

Chen-jj commented Sep 3, 2019

@zzyhdu 大概猜到问题所在,试试两种方法: component.$scope.setData(dataDiff, cb) 这里。

  1. dataDiff 改为 data,不用 diff 后的数据。
  2. JSON.parse(JSON.stringify(dataDiff)) 先序列化 setData 的数据。

然后你需要提供完整可复现代码,文本格式。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants