From 500fa709b2ac77e30f6c6af7639166006d4b303e Mon Sep 17 00:00:00 2001 From: YuJian Date: Tue, 26 Apr 2022 16:42:42 +0800 Subject: [PATCH] vault backup: 2022-04-26 16:42:42 --- .../React 的流程解析 - commit阶段.md | 49 ++++++++----------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/React 的源码深入/React 的流程解析 - commit 阶段/React 的流程解析 - commit阶段.md b/React 的源码深入/React 的流程解析 - commit 阶段/React 的流程解析 - commit阶段.md index a601c0c..4b810d2 100644 --- a/React 的源码深入/React 的流程解析 - commit 阶段/React 的流程解析 - commit阶段.md +++ b/React 的源码深入/React 的流程解析 - commit 阶段/React 的流程解析 - commit阶段.md @@ -88,35 +88,28 @@ do { ```javascript do { -{ -invokeGuardedCallback( - null, - commitMutationEffects, - null, - root, - renderPriorityLevel -); - if (hasCaughtError()) { - - if (!(nextEffect !== null)) { - { - throw Error( "Should be working on an effect." ); + { + invokeGuardedCallback( + null, + commitMutationEffects, + null, + root, + renderPriorityLevel + ); + if (hasCaughtError()) { + if (!(nextEffect !== null)) { + { + throw Error( "Should be working on an effect." ); + } + } + var _error = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error); + nextEffect = nextEffect.nextEffect; } } +} while (nextEffect !== null); +``` - - - var _error = clearCaughtError(); - - - - captureCommitPhaseError(nextEffect, _error); - - nextEffect = nextEffect.nextEffect; - - } - - } +和 before 的循环非常类似,commitMutationEffects 也是有 invokeGuardedCallback 调用,也有着相同 Error Boundaries 的逻辑 - } while (nextEffect !== null); -``` \ No newline at end of file +关于 commitMutationEffects: [[React 的深入探索 - commitMutationEffects]]