Skip to content

Conversation

@OpenGG
Copy link

@OpenGG OpenGG commented Oct 21, 2016

  1. setData() 内部有深度复制逻辑, shallowEqual() 不管用的
  2. 由于上述原因,每一次触发 store 改变,都会导致所有页面数据被刷新
  3. setData() 涉及到跨线程通信/序列化等,开销不小,传入的对象太大,性能上有问题

Weapp use deep cloning in .setData() internally, so mappedState will never be
shallow equal to data. In another word, shallowEqual(this.data, mappedState)
will always return false.
By tracking states in connect(), we can get patches between states, which can
be later applied to .setData().
@charleyw
Copy link
Owner

不好意思,这两天比较忙,一直没时间看。
等下星期我详细看一下再merge

@chrisHchen
Copy link

如果是更深的嵌套数据还是会去clone整个key吧

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

Successfully merging this pull request may close these issues.

3 participants