Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ export let didWarnAboutReassigningProps: boolean;
let didWarnAboutRevealOrder;
let didWarnAboutTailOptions;
let didWarnAboutClassNameOnViewTransition;
let didWarnAboutExpectedLoadTime = false;

if (__DEV__) {
didWarnAboutBadClass = ({}: {[string]: boolean});
Expand Down Expand Up @@ -2457,22 +2456,7 @@ function updateSuspenseComponent(
}

return bailoutOffscreenComponent(null, primaryChildFragment);
} else if (
enableCPUSuspense &&
(typeof nextProps.unstable_expectedLoadTime === 'number' ||
nextProps.defer === true)
) {
if (__DEV__) {
if (typeof nextProps.unstable_expectedLoadTime === 'number') {
if (!didWarnAboutExpectedLoadTime) {
didWarnAboutExpectedLoadTime = true;
console.error(
'<Suspense unstable_expectedLoadTime={...}> is deprecated. ' +
'Use <Suspense defer={true}> instead.',
);
}
}
}
} else if (enableCPUSuspense && nextProps.defer === true) {
// This is a CPU-bound tree. Skip this tree and show a placeholder to
// unblock the surrounding content. Then immediately retry after the
// initial commit.
Expand Down
47 changes: 0 additions & 47 deletions packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ let resolveText;
// let rejectText;

let assertLog;
let assertConsoleErrorDev;
let waitForPaint;

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

const InternalTestUtils = require('internal-test-utils');
assertLog = InternalTestUtils.assertLog;
assertConsoleErrorDev = InternalTestUtils.assertConsoleErrorDev;
waitForPaint = InternalTestUtils.waitForPaint;

textCache = new Map();
Expand Down Expand Up @@ -119,51 +117,6 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}
}

// @gate enableCPUSuspense
it('warns for the old name is used', async () => {
function App() {
return (
<>
<Text text="Outer" />
<div>
<Suspense
unstable_expectedLoadTime={1000}
fallback={<Text text="Loading..." />}>
<Text text="Inner" />
</Suspense>
</div>
</>
);
}

const root = ReactNoop.createRoot();
await act(async () => {
root.render(<App />);
await waitForPaint(['Outer', 'Loading...']);
assertConsoleErrorDev([
'<Suspense unstable_expectedLoadTime={...}> is deprecated. ' +
'Use <Suspense defer={true}> instead.' +
'\n in Suspense (at **)' +
'\n in App (at **)',
]);
expect(root).toMatchRenderedOutput(
<>
Outer
<div>Loading...</div>
</>,
);
});

// Inner contents finish in separate commit from outer
assertLog(['Inner']);
expect(root).toMatchRenderedOutput(
<>
Outer
<div>Inner</div>
</>,
);
});

// @gate enableCPUSuspense
it('skips CPU-bound trees on initial mount', async () => {
function App() {
Expand Down
1 change: 0 additions & 1 deletion packages/shared/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ export type SuspenseProps = {
suspenseCallback?: (Set<Wakeable> | null) => mixed,

unstable_avoidThisFallback?: boolean,
unstable_expectedLoadTime?: number,
defer?: boolean,
name?: string,
};
Expand Down
Loading