diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js
index 1fd71e3cfc5e..55793fb6c3b3 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js
@@ -3108,6 +3108,81 @@ describe('ReactSuspenseWithNoopRenderer', () => {
},
);
+ it(
+ 'fallback component can update itself even after a high pri update to ' +
+ 'the primary tree suspends',
+ async () => {
+ const {useState} = React;
+ const root = ReactNoop.createRoot();
+
+ let setAppText;
+ function App() {
+ const [text, _setText] = useState('A');
+ setAppText = _setText;
+ return (
+ <>
+ }>
+
+
+ >
+ );
+ }
+
+ let setFallbackText;
+ function Fallback() {
+ const [text, _setText] = useState('Loading...');
+ setFallbackText = _setText;
+ return ;
+ }
+
+ // Resolve the initial tree
+ await resolveText('A');
+ await ReactNoop.act(async () => {
+ root.render();
+ });
+ expect(Scheduler).toHaveYielded(['A']);
+ expect(root).toMatchRenderedOutput();
+
+ // Schedule an update inside the Suspense boundary that suspends.
+ await ReactNoop.act(async () => {
+ setAppText('B');
+ });
+ expect(Scheduler).toHaveYielded(['Suspend! [B]', 'Loading...']);
+ // Commit the placeholder
+ await advanceTimers(250);
+ expect(root).toMatchRenderedOutput(
+ <>
+
+
+ >,
+ );
+
+ // Schedule a high pri update on the boundary, and a lower pri update
+ // on the fallback. We're testing to make sure the fallback can still
+ // update even though the primary tree is suspended.
+ await ReactNoop.act(async () => {
+ ReactNoop.discreteUpdates(() => {
+ setAppText('C');
+ });
+ setFallbackText('Still loading...');
+ });
+
+ expect(Scheduler).toHaveYielded([
+ // First try to update the suspended tree. It's still suspended.
+ 'Suspend! [C]',
+ 'Loading...',
+ // Then complete the update to the fallback.
+ 'Still loading...',
+ ]);
+ expect(root).toMatchRenderedOutput(
+ <>
+
+
+ >,
+ );
+ },
+ );
+
it(
'regression: primary fragment fiber is not always part of setState ' +
'return path',