Remove unstable_expectedLoadTime option (#35051)
Follow up to #35022. It's now replaced by the `defer` option. Sounds like nobody is actually using this option, including Meta, so we can just delete it.
Sebastian Markbåge committed
Nov 5, 2025 at 15:52 UTC
fa767dade6a22be994b5bf348fdabfc5301f72b4
3 files changed
+1
-65
packages/react-reconciler/src/ReactFiberBeginWork.js
+1
-17
@@ -325,7 +325,6 @@ export let didWarnAboutReassigningProps: boolean;
325
let didWarnAboutRevealOrder;
326
let didWarnAboutTailOptions;
327
let didWarnAboutClassNameOnViewTransition;
328
-let didWarnAboutExpectedLoadTime = false;
328
329
if (__DEV__) {
330
didWarnAboutBadClass = ({}: {[string]: boolean});
@@ -2457,22 +2456,7 @@ function updateSuspenseComponent(
2456
}
2457
2458
return bailoutOffscreenComponent(null, primaryChildFragment);
2460
- } else if (
2461
- enableCPUSuspense &&
2462
- (typeof nextProps.unstable_expectedLoadTime === 'number' ||
2463
- nextProps.defer === true)
2464
- ) {
2465
- if (__DEV__) {
2466
- if (typeof nextProps.unstable_expectedLoadTime === 'number') {
2467
- if (!didWarnAboutExpectedLoadTime) {
2468
- didWarnAboutExpectedLoadTime = true;
2469
- console.error(
2470
- '<Suspense unstable_expectedLoadTime={...}> is deprecated. ' +
2471
- 'Use <Suspense defer={true}> instead.',
2472
- );
2473
- }
2474
- }
2475
- }
2459
+ } else if (enableCPUSuspense && nextProps.defer === true) {
2460
// This is a CPU-bound tree. Skip this tree and show a placeholder to
2461
// unblock the surrounding content. Then immediately retry after the
2462
// initial commit.
packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js
-47
@@ -13,7 +13,6 @@ let resolveText;
13
// let rejectText;
14
15
let assertLog;
16
-let assertConsoleErrorDev;
16
let waitForPaint;
17
18
describe('ReactSuspenseWithNoopRenderer', () => {
@@ -29,7 +28,6 @@ describe('ReactSuspenseWithNoopRenderer', () => {
28
29
const InternalTestUtils = require('internal-test-utils');
30
assertLog = InternalTestUtils.assertLog;
32
- assertConsoleErrorDev = InternalTestUtils.assertConsoleErrorDev;
31
waitForPaint = InternalTestUtils.waitForPaint;
32
33
textCache = new Map();
@@ -119,51 +117,6 @@ describe('ReactSuspenseWithNoopRenderer', () => {
117
}
118
}
119
122
- // @gate enableCPUSuspense
123
- it('warns for the old name is used', async () => {
124
- function App() {
125
- return (
126
- <>
127
- <Text text="Outer" />
128
- <div>
129
- <Suspense
130
- unstable_expectedLoadTime={1000}
131
- fallback={<Text text="Loading..." />}>
132
- <Text text="Inner" />
133
- </Suspense>
134
- </div>
135
- </>
136
- );
137
- }
138
-
139
- const root = ReactNoop.createRoot();
140
- await act(async () => {
141
- root.render(<App />);
142
- await waitForPaint(['Outer', 'Loading...']);
143
- assertConsoleErrorDev([
144
- '<Suspense unstable_expectedLoadTime={...}> is deprecated. ' +
145
- 'Use <Suspense defer={true}> instead.' +
146
- '\n in Suspense (at **)' +
147
- '\n in App (at **)',
148
- ]);
149
- expect(root).toMatchRenderedOutput(
150
- <>
151
- Outer
152
- <div>Loading...</div>
153
- </>,
154
- );
155
- });
156
-
157
- // Inner contents finish in separate commit from outer
158
- assertLog(['Inner']);
159
- expect(root).toMatchRenderedOutput(
160
- <>
161
- Outer
162
- <div>Inner</div>
163
- </>,
164
- );
165
- });
166
-
120
// @gate enableCPUSuspense
121
it('skips CPU-bound trees on initial mount', async () => {
122
function App() {
packages/shared/ReactTypes.js
-1
@@ -312,7 +312,6 @@ export type SuspenseProps = {
312
suspenseCallback?: (Set<Wakeable> | null) => mixed,
313
314
unstable_avoidThisFallback?: boolean,
315
- unstable_expectedLoadTime?: number,
315
defer?: boolean,
316
name?: string,
317
};