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

watch 函数中 setter 失效 #58

Closed
BuptStEve opened this issue Oct 9, 2018 · 1 comment
Closed

watch 函数中 setter 失效 #58

BuptStEve opened this issue Oct 9, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@BuptStEve
Copy link
Member

https://github.com/tuateam/tua-mp/blob/972a5925bbff2bb7ad7e057fc04b7c3b72ce1b26/packages/tua-mp/src/VmStatus.js#L106-L136

例如在 watch 中触发 setter,那么由于同步触发函数,同步清空状态,导致新的状态也被误清空了...

@BuptStEve BuptStEve added the bug Something isn't working label Oct 9, 2018
@BuptStEve BuptStEve self-assigned this Oct 9, 2018
@BuptStEve
Copy link
Member Author

BuptStEve commented Oct 9, 2018

可以通过在触发 watch 前提前清空状态来解决

const newStateByVM = this.newStateByVM
const oldStateByVM = this.oldStateByVM

this.newStateByVM = Object.create(null)
this.oldStateByVM = Object.create(null)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant