|
|
|
@ -161,6 +161,8 @@ switch 中的 case 逻辑太多了,全部都写出来会让笔记显得特别
@@ -161,6 +161,8 @@ switch 中的 case 逻辑太多了,全部都写出来会让笔记显得特别
|
|
|
|
|
|
|
|
|
|
### updateHostRoot |
|
|
|
|
|
|
|
|
|
首先会执行 pushHostRootContext 函数,这个函数与 context 有关 |
|
|
|
|
|
|
|
|
|
```javascript |
|
|
|
|
function updateHostRoot(current, workInProgress, renderLanes) { |
|
|
|
|
pushHostRootContext(workInProgress); |
|
|
|
@ -168,9 +170,30 @@ function updateHostRoot(current, workInProgress, renderLanes) {
@@ -168,9 +170,30 @@ function updateHostRoot(current, workInProgress, renderLanes) {
|
|
|
|
|
if (current === null || updateQueue === null) { |
|
|
|
|
throw new Error("..."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var nextProps = workInProgress.pendingProps; |
|
|
|
|
var prevState = workInProgress.memoizedState; |
|
|
|
|
var prevChildren = prevState.element; |
|
|
|
|
var prevChildren = prevState.element; |
|
|
|
|
cloneUpdateQueue(current, workInProgress); |
|
|
|
|
processUpdateQueue(workInProgress, nextProps, null, renderLanes); |
|
|
|
|
var nextState = workInProgress.memoizedState; |
|
|
|
|
var root = workInProgress.stateNode; |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
var nextCache = nextState.cache; |
|
|
|
|
pushRootCachePool(root); |
|
|
|
|
pushCacheProvider(workInProgress, nextCache); |
|
|
|
|
|
|
|
|
|
if (nextCache !== prevState.cache) { |
|
|
|
|
propagateContextChange( |
|
|
|
|
workInProgress, |
|
|
|
|
CacheContext, |
|
|
|
|
renderLanes |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
...... |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|