Skip to content

Commit

Permalink
Turn off enableYieldingBeforePassive
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Dec 19, 2024
1 parent 7eb8234 commit 209b425
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,41 @@ describe('ReactSuspenseyCommitPhase', () => {
</>,
);
});

it('flushes passive effects', 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...');

resolveSuspenseyThing('A');

expect(root).toMatchRenderedOutput(
<>
{'render effect'}
<suspensey-thing src="A" />
</>,
);
});
});

0 comments on commit 209b425

Please sign in to comment.