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

Remove the deprecated React Flare event system #19520

Merged
merged 3 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Address feedback
  • Loading branch information
trueadm committed Aug 5, 2020
commit 05a69b43756941b3d4e865ab5339ba2e55fbdfb6
Original file line number Diff line number Diff line change
Expand Up @@ -2220,13 +2220,10 @@ describe('ReactDOMServerPartialHydration', () => {

function Button() {
const ref = React.useRef(null);
const effect = () => {
return setClick(ref.current, onEvent);
};
if (isServerRendering) {
React.useEffect(effect);
} else {
React.useLayoutEffect(effect);
if (!isServerRendering) {
React.useLayoutEffect(() => {
return setClick(ref.current, onEvent);
});
}
return <a ref={ref}>Click me</a>;
}
Expand Down Expand Up @@ -2379,13 +2376,10 @@ describe('ReactDOMServerPartialHydration', () => {
function Button() {
const ref = React.useRef(null);

const effect = () => {
return setClick(ref.current, onEvent);
};
if (isServerRendering) {
React.useEffect(effect);
} else {
React.useLayoutEffect(effect);
if (!isServerRendering) {
React.useLayoutEffect(() => {
return setClick(ref.current, onEvent);
});
}

return <a ref={ref}>Click me</a>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,12 @@ describe('ReactDOMServerSelectiveHydration', () => {
function Child({text}) {
const ref = React.useRef(null);
Scheduler.unstable_yieldValue(text);
const effect = () => {
return setClick(ref.current, () => {
Scheduler.unstable_yieldValue('Clicked ' + text);
if (!isServerRendering) {
React.useLayoutEffect(() => {
return setClick(ref.current, () => {
Scheduler.unstable_yieldValue('Clicked ' + text);
});
});
};
if (isServerRendering) {
React.useEffect(effect);
} else {
React.useLayoutEffect(effect);
}

return <span ref={ref}>{text}</span>;
Expand Down Expand Up @@ -433,15 +430,12 @@ describe('ReactDOMServerSelectiveHydration', () => {
}
Scheduler.unstable_yieldValue(text);

const effect = () => {
return setClick(ref.current, () => {
Scheduler.unstable_yieldValue('Clicked ' + text);
if (!isServerRendering) {
React.useLayoutEffect(() => {
return setClick(ref.current, () => {
Scheduler.unstable_yieldValue('Clicked ' + text);
});
});
};
if (isServerRendering) {
React.useEffect(effect);
} else {
React.useLayoutEffect(effect);
}

return <span ref={ref}>{text}</span>;
Expand Down Expand Up @@ -524,15 +518,12 @@ describe('ReactDOMServerSelectiveHydration', () => {
}
Scheduler.unstable_yieldValue(text);

const effect = () => {
return setClick(ref.current, () => {
Scheduler.unstable_yieldValue('Clicked ' + text);
if (!isServerRendering) {
React.useLayoutEffect(() => {
return setClick(ref.current, () => {
Scheduler.unstable_yieldValue('Clicked ' + text);
});
});
};
if (isServerRendering) {
React.useEffect(effect);
} else {
React.useLayoutEffect(effect);
}
return <span ref={ref}>{text}</span>;
}
Expand Down