Skip to content

Commit

Permalink
Revert "Switched from manual merging of PopperProps to using deepmerge."
Browse files Browse the repository at this point in the history
This reverts commit 3aad195.
  • Loading branch information
Oliver Haynes committed Feb 26, 2020
1 parent 3aad195 commit e623048
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/material-ui/src/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import setRef from '../utils/setRef';
import { useIsFocusVisible } from '../utils/focusVisible';
import useControlled from '../utils/useControlled';
import useTheme from '../styles/useTheme';
import deepmerge from 'deepmerge'

function round(value) {
return Math.round(value * 1e5) / 1e5;
Expand Down Expand Up @@ -485,18 +484,22 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
}
}

const PopperPropsToPassToPopper = React.useMemo(() => {
const defaultPopperOptions = {
const { popperOptions, ...PopperPropsRest } = PopperProps || {};

// Avoid the creation of a new Popper.js instance at each render.
const popperOptionsWithArrow = React.useMemo(
() => ({
...popperOptions,
modifiers: {
arrow: {
enabled: Boolean(arrowRef),
element: arrowRef
}
}
}

return deepmerge({ popperOptions: defaultPopperOptions }, PopperProps || {})
}, [arrowRef, PopperProps])
element: arrowRef,
},
...(popperOptions && popperOptions.modifiers),
},
}),
[arrowRef, popperOptions],
);

return (
<React.Fragment>
Expand All @@ -511,8 +514,9 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
open={childNode ? open : false}
id={childrenProps['aria-describedby']}
transition
popperOptions={popperOptionsWithArrow}
{...interactiveWrapperListeners}
{...PopperPropsToPassToPopper}
{...PopperPropsRest}
>
{({ placement: placementInner, TransitionProps: TransitionPropsInner }) => (
<TransitionComponent
Expand Down

0 comments on commit e623048

Please sign in to comment.