Skip to content

Commit

Permalink
Clean up Selective Hydration / Event Replay flag (#24156)
Browse files Browse the repository at this point in the history
* clean up selective hydration / replay flag

* dont export return_targetInst
  • Loading branch information
salazarm authored Mar 24, 2022
1 parent 1159ff6 commit 6b85823
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 565 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2418,18 +2418,8 @@ describe('ReactDOMServerPartialHydration', () => {
await promise;
});

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');
}
expect(clicks).toBe(0);
expect(container.textContent).toBe('Click meHello');
document.body.removeChild(container);
});

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

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

expect(onEvent).toHaveBeenCalledTimes(0);
document.body.removeChild(container);
});

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

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

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

expect(onEvent).toHaveBeenCalledTimes(0);
document.body.removeChild(container);
});

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

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);
}
expect(clicksOnChild).toBe(0);
expect(clicksOnParent).toBe(0);

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

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

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

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');
}
// discrete event not replayed
expect(submits).toBe(0);
expect(container.textContent).toBe('Click meHello');

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

0 comments on commit 6b85823

Please sign in to comment.