From 010c9241cbaac8f74830058b08716320366765b9 Mon Sep 17 00:00:00 2001 From: Eli White Date: Tue, 18 Feb 2020 19:01:13 -0800 Subject: [PATCH] Partial React Sync from 241c4467..edab5c074 Summary: - **[edab5c074](https://github.com/facebook/react/commit/edab5c074 )**: Re-throw errors thrown by the renderer at the root in the complete phase (#18029) //// Changelog: [General][Changed] Partial React Sync from 241c4467..edab5c074 Reviewed By: mdvacca, gaearon Differential Revision: D19961765 fbshipit-source-id: d4a84a4076da332db76d66ddd7250eaea375f8ff --- Libraries/Renderer/implementations/ReactFabric-dev.fb.js | 9 ++++++++- Libraries/Renderer/implementations/ReactFabric-dev.js | 9 ++++++++- .../Renderer/implementations/ReactFabric-prod.fb.js | 2 +- Libraries/Renderer/implementations/ReactFabric-prod.js | 2 +- .../Renderer/implementations/ReactFabric-profiling.fb.js | 2 +- .../Renderer/implementations/ReactFabric-profiling.js | 2 +- .../implementations/ReactNativeRenderer-dev.fb.js | 9 ++++++++- .../Renderer/implementations/ReactNativeRenderer-dev.js | 9 ++++++++- .../implementations/ReactNativeRenderer-prod.fb.js | 2 +- .../Renderer/implementations/ReactNativeRenderer-prod.js | 2 +- .../implementations/ReactNativeRenderer-profiling.fb.js | 2 +- .../implementations/ReactNativeRenderer-profiling.js | 2 +- 12 files changed, 40 insertions(+), 12 deletions(-) diff --git a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 2803fa662a..2d7fe7690e 100644 --- a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -20488,7 +20488,14 @@ function handleError(root, thrownValue) { // supposed to capture all errors that weren't caught by an error // boundary. workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; + workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next + // sibling, or the parent if there are no siblings. But since the root + // has no siblings nor a parent, we set it to null. Usually this is + // handled by `completeUnitOfWork` or `unwindWork`, but since we're + // interntionally not calling those, we need set it here. + // TODO: Consider calling `unwindWork` to pop the contexts. + + workInProgress = null; return null; } diff --git a/Libraries/Renderer/implementations/ReactFabric-dev.js b/Libraries/Renderer/implementations/ReactFabric-dev.js index 34fc57e4a1..86120239ae 100644 --- a/Libraries/Renderer/implementations/ReactFabric-dev.js +++ b/Libraries/Renderer/implementations/ReactFabric-dev.js @@ -20486,7 +20486,14 @@ function handleError(root, thrownValue) { // supposed to capture all errors that weren't caught by an error // boundary. workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; + workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next + // sibling, or the parent if there are no siblings. But since the root + // has no siblings nor a parent, we set it to null. Usually this is + // handled by `completeUnitOfWork` or `unwindWork`, but since we're + // interntionally not calling those, we need set it here. + // TODO: Consider calling `unwindWork` to pop the contexts. + + workInProgress = null; return null; } diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 9af61e65f0..03c2c9de27 100644 --- a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -6015,7 +6015,7 @@ function handleError(root$jscomp$0, thrownValue) { return ( (workInProgressRootExitStatus = RootFatalErrored), (workInProgressRootFatalError = thrownValue), - null + (workInProgress = null) ); a: { var root = root$jscomp$0, diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.js b/Libraries/Renderer/implementations/ReactFabric-prod.js index f01193097b..9dc016a3c7 100644 --- a/Libraries/Renderer/implementations/ReactFabric-prod.js +++ b/Libraries/Renderer/implementations/ReactFabric-prod.js @@ -6006,7 +6006,7 @@ function handleError(root$jscomp$0, thrownValue) { return ( (workInProgressRootExitStatus = RootFatalErrored), (workInProgressRootFatalError = thrownValue), - null + (workInProgress = null) ); a: { var root = root$jscomp$0, diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 13a1f2473a..43c1c91b6e 100644 --- a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -6090,7 +6090,7 @@ function handleError(root$jscomp$0, thrownValue) { return ( (workInProgressRootExitStatus = RootFatalErrored), (workInProgressRootFatalError = thrownValue), - null + (workInProgress = null) ); workInProgress.mode & 8 && stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !0); diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.js b/Libraries/Renderer/implementations/ReactFabric-profiling.js index 2ca09dec59..734988e36d 100644 --- a/Libraries/Renderer/implementations/ReactFabric-profiling.js +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.js @@ -6081,7 +6081,7 @@ function handleError(root$jscomp$0, thrownValue) { return ( (workInProgressRootExitStatus = RootFatalErrored), (workInProgressRootFatalError = thrownValue), - null + (workInProgress = null) ); workInProgress.mode & 8 && stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !0); diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 4dea1e5dfe..82a5d55052 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -20791,7 +20791,14 @@ function handleError(root, thrownValue) { // supposed to capture all errors that weren't caught by an error // boundary. workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; + workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next + // sibling, or the parent if there are no siblings. But since the root + // has no siblings nor a parent, we set it to null. Usually this is + // handled by `completeUnitOfWork` or `unwindWork`, but since we're + // interntionally not calling those, we need set it here. + // TODO: Consider calling `unwindWork` to pop the contexts. + + workInProgress = null; return null; } diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js index 495a81896d..c04befdee3 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js @@ -20789,7 +20789,14 @@ function handleError(root, thrownValue) { // supposed to capture all errors that weren't caught by an error // boundary. workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; + workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next + // sibling, or the parent if there are no siblings. But since the root + // has no siblings nor a parent, we set it to null. Usually this is + // handled by `completeUnitOfWork` or `unwindWork`, but since we're + // interntionally not calling those, we need set it here. + // TODO: Consider calling `unwindWork` to pop the contexts. + + workInProgress = null; return null; } diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index df06a80d7d..228bb6bb01 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -6245,7 +6245,7 @@ function handleError(root$jscomp$0, thrownValue) { return ( (workInProgressRootExitStatus = RootFatalErrored), (workInProgressRootFatalError = thrownValue), - null + (workInProgress = null) ); a: { var root = root$jscomp$0, diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js index d30a108737..9f83a047a6 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js @@ -6235,7 +6235,7 @@ function handleError(root$jscomp$0, thrownValue) { return ( (workInProgressRootExitStatus = RootFatalErrored), (workInProgressRootFatalError = thrownValue), - null + (workInProgress = null) ); a: { var root = root$jscomp$0, diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 3ed0b61753..d513d59ed3 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -6321,7 +6321,7 @@ function handleError(root$jscomp$0, thrownValue) { return ( (workInProgressRootExitStatus = RootFatalErrored), (workInProgressRootFatalError = thrownValue), - null + (workInProgress = null) ); workInProgress.mode & 8 && stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !0); diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js index 1a351beab1..ae803fa22a 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js @@ -6311,7 +6311,7 @@ function handleError(root$jscomp$0, thrownValue) { return ( (workInProgressRootExitStatus = RootFatalErrored), (workInProgressRootFatalError = thrownValue), - null + (workInProgress = null) ); workInProgress.mode & 8 && stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !0);