[FIX] move error handling out of fiber, fix complicated mounted issues

This commit is contained in:
Géry Debongnie
2021-11-30 22:21:27 +01:00
committed by Aaron Bohy
parent 1da3ecdbee
commit f32b1deb2c
7 changed files with 157 additions and 28 deletions
+6 -7
View File
@@ -20,23 +20,22 @@ function _handleError(node: ComponentNode | null, error: any, isFirstRound = fal
fiber.root.counter--;
}
let propagate = true;
let stopped = false;
for (const h of errorHandlers) {
try {
h(error);
propagate = false;
stopped = true;
break;
} catch (e) {
error = e;
}
}
if (propagate) {
return _handleError(node.parent, error);
if (stopped) {
return true;
}
return true;
} else {
return _handleError(node.parent, error);
}
return _handleError(node.parent, error);
}
type ErrorParams = { error: any } & ({ node: ComponentNode } | { fiber: Fiber });