GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update error message for suspending at sync priority (#23361) · react/react@3a60844

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • react-dom/src
      • __tests__
        • ReactDOMServerSuspense-test.internal.js
      • server
        • ReactDOMLegacyServerBrowser.js
    • react-reconciler/src
      • ReactFiberThrow.new.js
      • ReactFiberThrow.old.js
      • __tests__
        • ReactSuspenseWithNoopRenderer-test.js
  • scripts/error-codes
    • codes.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ describe('ReactDOMServerSuspense', () => {
187187
1,
188188
);
189189
},
190-
'Add a <Suspense fallback=...> component higher in the tree',
190+
'A component suspended while responding to synchronous input.',
191191
);
192192

193193
itThrowsWhenRendering(
@@ -200,7 +200,7 @@ describe('ReactDOMServerSuspense', () => {
200200
1,
201201
);
202202
},
203-
'Add a <Suspense fallback=...> component higher in the tree',
203+
'A component suspended while responding to synchronous input.',
204204
);
205205
}
206206

Collapse file

‎packages/react-dom/src/server/ReactDOMLegacyServerBrowser.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/server/ReactDOMLegacyServerBrowser.js
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ function renderToStringImpl(
7878
}
7979

8080
if (!readyToStream) {
81+
// Note: This error message is the one we use on the client. It doesn't
82+
// really make sense here. But this is the legacy server renderer, anyway.
83+
// We're going to delete it soon.
8184
throw new Error(
82-
'A React component suspended while rendering, but no fallback UI was specified.\n' +
83-
'\n' +
84-
'Add a <Suspense fallback=...> component higher in the tree to ' +
85-
'provide a loading indicator or placeholder to display.',
85+
'A component suspended while responding to synchronous input. This ' +
86+
'will cause the UI to be replaced with a loading indicator. To fix, ' +
87+
'updates that suspend should be wrapped with startTransition.',
8688
);
8789
}
8890

Collapse file

‎packages/react-reconciler/src/ReactFiberThrow.new.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberThrow.new.js
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,11 @@ function throwException(
499499
// This is a sync/discrete update. We treat this case like an error
500500
// because discrete renders are expected to produce a complete tree
501501
// synchronously to maintain consistency with external state.
502-
503-
// TODO: We should never call getComponentNameFromFiber in production.
504-
// Log a warning or something to prevent us from accidentally bundling it.
505502
const uncaughtSuspenseError = new Error(
506-
(getComponentNameFromFiber(sourceFiber) || 'A React component') +
507-
' suspended while rendering, but no fallback UI was specified.\n' +
508-
'\n' +
509-
'Add a <Suspense fallback=...> component higher in the tree to ' +
510-
'provide a loading indicator or placeholder to display.',
503+
'A component suspended while responding to synchronous input. This ' +
504+
'will cause the UI to be replaced with a loading indicator. To ' +
505+
'fix, updates that suspend should be wrapped ' +
506+
'with startTransition.',
511507
);
512508

513509
// If we're outside a transition, fall through to the regular error path.
Collapse file

‎packages/react-reconciler/src/ReactFiberThrow.old.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberThrow.old.js
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,11 @@ function throwException(
499499
// This is a sync/discrete update. We treat this case like an error
500500
// because discrete renders are expected to produce a complete tree
501501
// synchronously to maintain consistency with external state.
502-
503-
// TODO: We should never call getComponentNameFromFiber in production.
504-
// Log a warning or something to prevent us from accidentally bundling it.
505502
const uncaughtSuspenseError = new Error(
506-
(getComponentNameFromFiber(sourceFiber) || 'A React component') +
507-
' suspended while rendering, but no fallback UI was specified.\n' +
508-
'\n' +
509-
'Add a <Suspense fallback=...> component higher in the tree to ' +
510-
'provide a loading indicator or placeholder to display.',
503+
'A component suspended while responding to synchronous input. This ' +
504+
'will cause the UI to be replaced with a loading indicator. To ' +
505+
'fix, updates that suspend should be wrapped ' +
506+
'with startTransition.',
511507
);
512508

513509
// If we're outside a transition, fall through to the regular error path.
Collapse file

‎packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,9 +1011,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
10111011
ReactNoop.flushSync(() => {
10121012
ReactNoop.render(<AsyncText text="Async" />);
10131013
});
1014-
}).toThrow(
1015-
'AsyncText suspended while rendering, but no fallback UI was specified.',
1016-
);
1014+
}).toThrow('A component suspended while responding to synchronous input.');
10171015
});
10181016

10191017
// @gate enableCache
Collapse file

‎scripts/error-codes/codes.json‎

Copy file name to clipboardExpand all lines: scripts/error-codes/codes.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,5 +409,6 @@
409409
"421": "There was an error while hydrating this Suspense boundary. Switched to client rendering.",
410410
"422": "There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.",
411411
"423": "This root received an early update, before anything was able hydrate. Switched the entire root to client rendering.",
412-
"424": "Text content does not match server-rendered HTML."
412+
"424": "Text content does not match server-rendered HTML.",
413+
"425": "A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition."
413414
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.