diff --git a/packages/react-reconciler/src/ReactFiberNewContext.new.js b/packages/react-reconciler/src/ReactFiberNewContext.new.js
index 9d2484a783971..c9933f2362ad3 100644
--- a/packages/react-reconciler/src/ReactFiberNewContext.new.js
+++ b/packages/react-reconciler/src/ReactFiberNewContext.new.js
@@ -157,10 +157,6 @@ export function scheduleWorkOnParentPath(
!isSubsetOfLanes(alternate.childLanes, renderLanes)
) {
alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes);
- } else {
- // Neither alternate was updated, which means the rest of the
- // ancestor path already has sufficient priority.
- break;
}
node = node.return;
}
diff --git a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
index e0fcab7a77cc0..29fc2bea7c6b4 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
@@ -1523,4 +1523,63 @@ describe('ReactSuspense', () => {
expect(root).toMatchRenderedOutput('new value');
});
});
+
+ it('updates context consumer within child of suspended suspense component when context updates', () => {
+ const {createContext, useState} = React;
+
+ const ValueContext = createContext(null);
+
+ const promiseThatNeverResolves = new Promise(() => {});
+ function Child() {
+ return (
+
+ {value => {
+ Scheduler.unstable_yieldValue(`Received context value [${value}]`);
+ if (value === 'default') return ;
+ throw promiseThatNeverResolves;
+ }}
+
+ );
+ }
+
+ let setValue;
+ function Wrapper({children}) {
+ const [value, _setValue] = useState('default');
+ setValue = _setValue;
+ return (
+ {children}
+ );
+ }
+
+ function App() {
+ return (
+
+ }>
+
+
+
+ );
+ }
+
+ const root = ReactTestRenderer.create();
+ expect(Scheduler).toHaveYielded([
+ 'Received context value [default]',
+ 'default',
+ ]);
+ expect(root).toMatchRenderedOutput('default');
+
+ act(() => setValue('new value'));
+ expect(Scheduler).toHaveYielded([
+ 'Received context value [new value]',
+ 'Loading...',
+ ]);
+ expect(root).toMatchRenderedOutput('Loading...');
+
+ act(() => setValue('default'));
+ expect(Scheduler).toHaveYielded([
+ 'Received context value [default]',
+ 'default',
+ ]);
+ expect(root).toMatchRenderedOutput('default');
+ });
});