Skip to content

Commit

Permalink
Turn off enableYieldingBeforePassive (#31857)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Dec 19, 2024
1 parent 36d15d5 commit 518d06d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,46 @@ describe('ReactSuspenseyCommitPhase', () => {
</>,
);
});

// FIXME: Should pass with `enableYieldingBeforePassive`
// @gate !enableYieldingBeforePassive
it('runs passive effects after suspended commit resolves', async () => {
function Effect() {
React.useEffect(() => {
Scheduler.log('flush effect');
});
return <Text text="render effect" />;
}

const root = ReactNoop.createRoot();

await act(() => {
root.render(
<Suspense fallback={<Text text="Loading..." />}>
<Effect />
<SuspenseyImage src="A" />
</Suspense>,
);
});

assertLog([
'render effect',
'Image requested [A]',
'Loading...',
'render effect',
]);
expect(root).toMatchRenderedOutput('Loading...');

await act(() => {
resolveSuspenseyThing('A');
});

assertLog(['flush effect']);
expect(root).toMatchRenderedOutput(
<>
{'render effect'}
<suspensey-thing src="A" />
</>,
);
});
});
3 changes: 2 additions & 1 deletion packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export const enableLegacyFBSupport = false;
// -----------------------------------------------------------------------------

// Yield to the browser event loop and not just the scheduler event loop before passive effects.
export const enableYieldingBeforePassive = __EXPERIMENTAL__;
// Fix gated tests that fail with this flag enabled before turning it back on.
export const enableYieldingBeforePassive = false;

export const enableLegacyCache = __EXPERIMENTAL__;

Expand Down

0 comments on commit 518d06d

Please sign in to comment.