From 778e1ed2e5ec22d4bac48e14167d3b4a6b28e8b8 Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Thu, 26 Sep 2024 00:20:03 +0200 Subject: [PATCH] [Fiber] Fix missing render times when we cancel a pending commit (#31065) --- packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js | 2 +- packages/react-reconciler/src/ReactFiberWorkLoop.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js index d46f61035b8d4..af53a2a6acf47 100644 --- a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js +++ b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js @@ -3401,7 +3401,7 @@ export function suspendResource( } } -export function waitForCommitToBeReady(): null | (Function => Function) { +export function waitForCommitToBeReady(): null | ((() => void) => () => void) { if (suspendedState === null) { throw new Error( 'Internal React Error: suspendedState null when it was expected to exists. Please report this as a React bug.', diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index 5206caa5c0f76..ff50ff6973d1e 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -1308,6 +1308,8 @@ function commitRootWhenReady( updatedLanes, suspendedRetryLanes, SUSPENDED_COMMIT, + completedRenderStartTime, + completedRenderEndTime, ), ); const didAttemptEntireTree = !didSkipSuspendedSiblings; @@ -3001,8 +3003,6 @@ function commitRoot( ReactSharedInternals.T = prevTransition; setCurrentUpdatePriority(previousUpdateLanePriority); } - - return null; } function commitRootImpl(