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

Revert "Clean up Selective Hydration / Event Replay flag (#24156)" #24402

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2415,8 +2415,18 @@ describe('ReactDOMServerPartialHydration', () => {
await promise;
});

expect(clicks).toBe(0);
expect(container.textContent).toBe('Click meHello');
if (
gate(
flags =>
flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay,
)
) {
expect(clicks).toBe(0);
expect(container.textContent).toBe('Click meHello');
} else {
expect(clicks).toBe(1);
expect(container.textContent).toBe('Hello');
}
document.body.removeChild(container);
});

Expand Down Expand Up @@ -2498,7 +2508,17 @@ describe('ReactDOMServerPartialHydration', () => {
await promise;
});

expect(onEvent).toHaveBeenCalledTimes(0);
if (
gate(
flags =>
flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay,
)
) {
expect(onEvent).toHaveBeenCalledTimes(0);
} else {
expect(onEvent).toHaveBeenCalledTimes(2);
}

document.body.removeChild(container);
});

Expand Down Expand Up @@ -2578,7 +2598,16 @@ describe('ReactDOMServerPartialHydration', () => {
await promise;
});

expect(clicks).toBe(0);
if (
gate(
flags =>
flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay,
)
) {
expect(clicks).toBe(0);
} else {
expect(clicks).toBe(2);
}

document.body.removeChild(container);
});
Expand Down Expand Up @@ -2663,7 +2692,17 @@ describe('ReactDOMServerPartialHydration', () => {
resolve();
await promise;
});
expect(onEvent).toHaveBeenCalledTimes(0);
if (
gate(
flags =>
flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay,
)
) {
expect(onEvent).toHaveBeenCalledTimes(0);
} else {
expect(onEvent).toHaveBeenCalledTimes(2);
}

document.body.removeChild(container);
});

Expand Down Expand Up @@ -2734,8 +2773,19 @@ describe('ReactDOMServerPartialHydration', () => {
await promise;
});

expect(clicksOnChild).toBe(0);
expect(clicksOnParent).toBe(0);
if (
gate(
flags =>
flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay,
)
) {
expect(clicksOnChild).toBe(0);
expect(clicksOnParent).toBe(0);
} else {
expect(clicksOnChild).toBe(1);
// This will be zero due to the stopPropagation.
expect(clicksOnParent).toBe(0);
}

document.body.removeChild(container);
});
Expand Down Expand Up @@ -2811,7 +2861,16 @@ describe('ReactDOMServerPartialHydration', () => {
});

// We're now full hydrated.
expect(clicks).toBe(0);
if (
gate(
flags =>
flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay,
)
) {
expect(clicks).toBe(0);
} else {
expect(clicks).toBe(1);
}

document.body.removeChild(parentContainer);
});
Expand Down Expand Up @@ -3080,9 +3139,19 @@ describe('ReactDOMServerPartialHydration', () => {
await promise;
});

// discrete event not replayed
expect(submits).toBe(0);
expect(container.textContent).toBe('Click meHello');
if (
gate(
flags =>
flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay,
)
) {
// discrete event not replayed
expect(submits).toBe(0);
expect(container.textContent).toBe('Click meHello');
} else {
expect(submits).toBe(1);
expect(container.textContent).toBe('Hello');
}

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