Skip to content

Commit 104c14d

Browse files
committed
Make the suspended commit reason string configurable by the host
1 parent 87f660b commit 104c14d

File tree

9 files changed

+47
-1
lines changed

9 files changed

+47
-1
lines changed

packages/react-art/src/ReactFiberConfigART.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ export function waitForCommitToBeReady(timeoutOffset) {
621621
return null;
622622
}
623623

624+
export function getSuspendedCommitReason(state, rootContainer) {
625+
return '';
626+
}
627+
624628
export const NotPendingTransition = null;
625629
export const HostTransitionContext: ReactContext<TransitionStatus> = {
626630
$$typeof: REACT_CONTEXT_TYPE,

packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6206,6 +6206,13 @@ export function waitForCommitToBeReady(
62066206
return null;
62076207
}
62086208

6209+
export function getSuspendedCommitReason(
6210+
state: SuspendedState,
6211+
rootContainer: Container,
6212+
): null | string {
6213+
return 'Suspended on CSS or Images';
6214+
}
6215+
62096216
function checkIfFullyUnsuspended(state: SuspendedState) {
62106217
if (state.count === 0 && (state.imgCount === 0 || !state.waitingForImages)) {
62116218
if (state.stylesheets) {

packages/react-native-renderer/src/ReactFiberConfigFabric.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,13 @@ export function waitForCommitToBeReady(
627627
return null;
628628
}
629629

630+
export function getSuspendedCommitReason(
631+
state: SuspendedState,
632+
rootContainer: Container,
633+
): null | string {
634+
return null;
635+
}
636+
630637
export type FragmentInstanceType = {
631638
_fragmentFiber: Fiber,
632639
_observers: null | Set<IntersectionObserver>,

packages/react-native-renderer/src/ReactFiberConfigNative.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,13 @@ export function waitForCommitToBeReady(
806806
return null;
807807
}
808808

809+
export function getSuspendedCommitReason(
810+
state: SuspendedState,
811+
rootContainer: Container,
812+
): null | string {
813+
return null;
814+
}
815+
809816
export const NotPendingTransition: TransitionStatus = null;
810817
export const HostTransitionContext: ReactContext<TransitionStatus> = {
811818
$$typeof: REACT_CONTEXT_TYPE,

packages/react-noop-renderer/src/createReactNoop.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,13 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
702702

703703
waitForCommitToBeReady,
704704

705+
getSuspendedCommitReason(
706+
state: SuspendedState,
707+
rootContainer: Container,
708+
): null | string {
709+
return null;
710+
},
711+
705712
NotPendingTransition: (null: TransitionStatus),
706713

707714
resetFormInstance(form: Instance) {},

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ import {
102102
startSuspendingCommit,
103103
suspendOnActiveViewTransition,
104104
waitForCommitToBeReady,
105+
getSuspendedCommitReason,
105106
preloadInstance,
106107
preloadResource,
107108
supportsHydration,
@@ -1552,7 +1553,9 @@ function commitRootWhenReady(
15521553
suspendedRetryLanes,
15531554
exitStatus,
15541555
suspendedState,
1555-
'Suspended on CSS or Images',
1556+
enableProfilerTimer
1557+
? getSuspendedCommitReason(suspendedState, root.containerInfo)
1558+
: null,
15561559
completedRenderStartTime,
15571560
completedRenderEndTime,
15581561
),

packages/react-reconciler/src/__tests__/ReactFiberHostContext-test.internal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ describe('ReactFiberHostContext', () => {
114114
waitForCommitToBeReady(state, timeoutOffset) {
115115
return null;
116116
},
117+
getSuspendedCommitReason(state, rootContainer) {
118+
return null;
119+
},
117120
supportsMutation: true,
118121
});
119122

packages/react-reconciler/src/forks/ReactFiberConfig.custom.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export const suspendInstance = $$$config.suspendInstance;
9999
export const suspendOnActiveViewTransition =
100100
$$$config.suspendOnActiveViewTransition;
101101
export const waitForCommitToBeReady = $$$config.waitForCommitToBeReady;
102+
export const getSuspendedCommitReason = $$$config.getSuspendedCommitReason;
102103
export const NotPendingTransition = $$$config.NotPendingTransition;
103104
export const HostTransitionContext = $$$config.HostTransitionContext;
104105
export const resetFormInstance = $$$config.resetFormInstance;

packages/react-test-renderer/src/ReactFiberConfigTestHost.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,13 @@ export function waitForCommitToBeReady(
589589
return null;
590590
}
591591

592+
export function getSuspendedCommitReason(
593+
state: SuspendedState,
594+
rootContainer: Container,
595+
): null | string {
596+
return null;
597+
}
598+
592599
export const NotPendingTransition: TransitionStatus = null;
593600
export const HostTransitionContext: ReactContext<TransitionStatus> = {
594601
$$typeof: REACT_CONTEXT_TYPE,

0 commit comments

Comments
 (0)