Open hkjpotato opened 3 years ago
https://twitter.com/dan_abramov/status/1120971795425832961?lang=en
I probably misunderstood the relationship between react16/17/18 terms: fiber, time slice, sync and async, concurrent, scheduling, priority.
https://segmentfault.com/a/1190000041268486
before 16: recursive sync , 16: linkedlist while sync original priority : expirationTime, bug of batch and priority "0.0.0-experimental-5faf377df", published over a year ago by acdlite npm@andrewclark.io
newer: lane "0.0.0-experimental-3d0895557", *react-18.9.9( published a year ago by gaearon dan.abramov@gmail.com
// This is the entry point for synchronous tasks that don't go through Scheduler
function performSyncWorkOnRoot {
...
do workLoopSync
}
function workLoopSync() {
// Already timed out, so perform work without checking if we need to yield.
while (workInProgress !== null) {
workInProgress = performUnitOfWork(workInProgress);
}
}
// This is the entry point for every concurrent task, i.e. anything that
// goes through Scheduler.
function performConcurrentWorkOnRoot(root, didTimeout) {
...
function workLoopConcurrent() {
// Perform work until Scheduler asks us to yield
while (workInProgress !== null && !shouldYield()) {
workInProgress = performUnitOfWork(workInProgress);
}
}
TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
https://github.com/facebook/react/issues/19804 better explanation
这些用词你不去看过往版本的comments根本不知道在讲啥子 一会asyncmode一会concurrent一会time slice一会resumable。直到现在我还是不是很确定commiting to dom那一步能不能“分片”。 我有一种感觉。react16和15的default是一样的 区别在于一个是硬跑完一个while loop,可能15就是传统recursion吧
基本上onchange这种还是会以workLoopSync执行,不理会scheduler不知道yield,最后会call commit 但是在这个过程中遇到defferred,由于defferred会再次触发一次内部setState,则,这一次的更新是属于concurrent的
Thank you. For quick reference, I will put related materials here for anyone who is interested in this topic:
related explanation
Originally posted by @hkjpotato in https://github.com/yisar/fre/discussions/259#discussioncomment-650952