Skip to content

Commit fa767da

Browse files
authored
Remove unstable_expectedLoadTime option (facebook#35051)
Follow up to facebook#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.
1 parent 0ba2f01 commit fa767da

File tree

3 files changed

+1
-65
lines changed

3 files changed

+1
-65
lines changed

packages/react-reconciler/src/ReactFiberBeginWork.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ export let didWarnAboutReassigningProps: boolean;
325325
let didWarnAboutRevealOrder;
326326
let didWarnAboutTailOptions;
327327
let didWarnAboutClassNameOnViewTransition;
328-
let didWarnAboutExpectedLoadTime = false;
329328

330329
if (__DEV__) {
331330
didWarnAboutBadClass = ({}: {[string]: boolean});
@@ -2457,22 +2456,7 @@ function updateSuspenseComponent(
24572456
}
24582457

24592458
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) {
24762460
// This is a CPU-bound tree. Skip this tree and show a placeholder to
24772461
// unblock the surrounding content. Then immediately retry after the
24782462
// initial commit.

packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ let resolveText;
1313
// let rejectText;
1414

1515
let assertLog;
16-
let assertConsoleErrorDev;
1716
let waitForPaint;
1817

1918
describe('ReactSuspenseWithNoopRenderer', () => {
@@ -29,7 +28,6 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2928

3029
const InternalTestUtils = require('internal-test-utils');
3130
assertLog = InternalTestUtils.assertLog;
32-
assertConsoleErrorDev = InternalTestUtils.assertConsoleErrorDev;
3331
waitForPaint = InternalTestUtils.waitForPaint;
3432

3533
textCache = new Map();
@@ -119,51 +117,6 @@ describe('ReactSuspenseWithNoopRenderer', () => {
119117
}
120118
}
121119

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-
167120
// @gate enableCPUSuspense
168121
it('skips CPU-bound trees on initial mount', async () => {
169122
function App() {

packages/shared/ReactTypes.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ export type SuspenseProps = {
312312
suspenseCallback?: (Set<Wakeable> | null) => mixed,
313313

314314
unstable_avoidThisFallback?: boolean,
315-
unstable_expectedLoadTime?: number,
316315
defer?: boolean,
317316
name?: string,
318317
};

0 commit comments

Comments
 (0)