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

不需要给 .setData() 传入整个 state,只传入变化的值就行了 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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