Skip to content

Commit

Permalink
Revert "Clean up Selective Hydration / Event Replay flag (#24156)"
Browse files Browse the repository at this point in the history
This reverts commit b5cca18.
  • Loading branch information
rickhanlonii committed Apr 14, 2022
1 parent b5cca18 commit b8834b8
Show file tree
Hide file tree
Showing 19 changed files with 565 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2418,8 +2418,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 @@ -2501,7 +2511,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 @@ -2581,7 +2601,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 @@ -2666,7 +2695,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 @@ -2737,8 +2776,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 @@ -2814,7 +2864,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 @@ -3083,9 +3142,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
Loading

0 comments on commit b8834b8

Please sign in to comment.