|
|
@ -208,6 +208,14 @@ if (remainingLanes === SyncLane) { |
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
这段代码是为了将当前的 root 重新调度一次,是因为在 commit 阶段有可能会产生新的更新 |
|
|
|
|
|
|
|
|
|
|
|
```javascript |
|
|
|
```javascript |
|
|
|
ensureRootIsScheduled(root, now()); |
|
|
|
ensureRootIsScheduled(root, now()); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
React 内会存在一些同步的更新(useLayoutEffect 中的触发更新),React 会将此放在 flushSyncCallbackQueue 函数中在 commit 阶段同步的执行 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```javascript |
|
|
|
|
|
|
|
flushSyncCallbackQueue(); |
|
|
|
``` |
|
|
|
``` |