Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync hydrate discrete events in capture phase and dont replay discrete events #22448

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test
  • Loading branch information
salazarm committed Oct 4, 2021
commit b23468e26582889f9f144e776439f973843121c1
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ describe('ReactDOMServerSelectiveHydration', () => {

// @gate enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay
it('Fires capture event handlers and native events if content is hydratable during discrete event', async () => {
salazarm marked this conversation as resolved.
Show resolved Hide resolved
spyOnDev(console, 'error');
function Child({text}) {
Scheduler.unstable_yieldValue(text);
const ref = React.useRef();
Expand Down Expand Up @@ -1019,15 +1020,16 @@ describe('ReactDOMServerSelectiveHydration', () => {
);
}

spyOnDev(console, 'error');
const finalHTML = ReactDOMServer.renderToString(<App />);
expect(console.error).toHaveBeenCalledTimes(2);
expect(console.error.calls.argsFor(0)[0]).toContain(
'useLayoutEffect does nothing on the server',
);
expect(console.error.calls.argsFor(1)[0]).toContain(
'useLayoutEffect does nothing on the server',
);
if (__DEV__) {
salazarm marked this conversation as resolved.
Show resolved Hide resolved
expect(console.error).toHaveBeenCalledTimes(2);
expect(console.error.calls.argsFor(0)[0]).toContain(
'useLayoutEffect does nothing on the server',
);
expect(console.error.calls.argsFor(1)[0]).toContain(
'useLayoutEffect does nothing on the server',
);
}

expect(Scheduler).toHaveYielded(['App', 'A', 'B']);

Expand Down Expand Up @@ -1061,6 +1063,8 @@ describe('ReactDOMServerSelectiveHydration', () => {
expect(Scheduler).toFlushAndYield(['A']);

document.body.removeChild(container);
expect(console.error).toHaveBeenCalledTimes(2);
if (__DEV__) {
expect(console.error).toHaveBeenCalledTimes(2);
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,13 @@ describe('DOMPluginEventSystem', () => {

// We're now full hydrated.

expect(clicks).toBe(1);
if (
ReactFeatureFlags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay
) {
expect(clicks).toBe(0);
} else {
expect(clicks).toBe(1);
}

document.body.removeChild(parentContainer);
});
Expand Down