|
|
|
@ -113,3 +113,31 @@ do {
@@ -113,3 +113,31 @@ do {
|
|
|
|
|
和 before 的循环非常类似,commitMutationEffects 也是有 invokeGuardedCallback 调用,也有着相同 Error Boundaries 的逻辑 |
|
|
|
|
|
|
|
|
|
关于 commitMutationEffects: [[React 的深入探索 - commitMutationEffects]] |
|
|
|
|
|
|
|
|
|
最后一个阶段:layout 阶段 |
|
|
|
|
|
|
|
|
|
```javascript |
|
|
|
|
do { |
|
|
|
|
{ |
|
|
|
|
invokeGuardedCallback( |
|
|
|
|
null, |
|
|
|
|
commitLayoutEffects, |
|
|
|
|
null, |
|
|
|
|
root, |
|
|
|
|
lanes |
|
|
|
|
); |
|
|
|
|
if (hasCaughtError()) { |
|
|
|
|
if (!(nextEffect !== null)) { |
|
|
|
|
{ |
|
|
|
|
throw Error( "Should be working on an effect." ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
var _error2 = clearCaughtError(); |
|
|
|
|
captureCommitPhaseError(nextEffect, _error2); |
|
|
|
|
nextEffect = nextEffect.nextEffect; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} while (nextEffect !== null); |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
关于 commitLayoutEffects: [[React 的深入探索 - commitLayoutEffects]] |