fix(reactive): avoid chain reactions missing #4328
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting a pull request, please make sure the following is done...
masterorformily_next.npm test).npm run lint) - we've done our best to make sure these rules match our internal linting guidelines.Please do not delete the above content
What have you changed?
可以查看最新的单个 commit 来看当前 pr 更改内容。
避免因链式响应,比如 fn1 收集依赖 A,fn2 收集并更新依赖 A,在 A 改变时,触发 fn1 和 fn2,其中 fn2 再次触发 fn1 时,因为 fn1 的防死循环机制(_boundary) ,导致 fn1 不能被再次触发获取到最新的依赖 A。
链式响应应该确保本身不会被再次执行,同时只需要触发最新的一次响应。
比如是先 fn1 再 fn2 的顺序,应该先执行 fn1 再执行 fn2 再执行 fn1 (一定会执行最新的一次)
如果两个函数调换顺序,则应该只需要执行 fn2 fn1,fn1 只会被执行一次(一定会执行最新的一次)
具体的响应策略和之前的 pr 不太一致,但想要解决的问题是一致的。
#4255