Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 13, 2019
1 parent 146f40d commit f10d116
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 54 deletions.
17 changes: 1 addition & 16 deletions docs/src/pages/components/slider/CustomizedSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,8 @@ const useStyles = makeStyles(theme => ({
function ValueLabelComponent(props) {
const { children, open, value } = props;

const popperRef = React.useRef(null);
React.useEffect(() => {
if (popperRef.current) {
popperRef.current.update();
}
});

return (
<Tooltip
PopperProps={{
popperRef,
}}
open={open}
enterTouchDelay={0}
placement="top"
title={value}
>
<Tooltip open={open} enterTouchDelay={0} placement="top" title={value}>
{children}
</Tooltip>
);
Expand Down
18 changes: 1 addition & 17 deletions docs/src/pages/components/slider/CustomizedSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { withStyles, makeStyles, Theme, createStyles } from '@material-ui/core/s
import Slider from '@material-ui/core/Slider';
import Typography from '@material-ui/core/Typography';
import Tooltip from '@material-ui/core/Tooltip';
import PopperJs from 'popper.js';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
Expand All @@ -25,23 +24,8 @@ interface Props {
function ValueLabelComponent(props: Props) {
const { children, open, value } = props;

const popperRef = React.useRef<PopperJs | null>(null);
React.useEffect(() => {
if (popperRef.current) {
popperRef.current.update();
}
});

return (
<Tooltip
PopperProps={{
popperRef,
}}
open={open}
enterTouchDelay={0}
placement="top"
title={value}
>
<Tooltip open={open} enterTouchDelay={0} placement="top" title={value}>
{children}
</Tooltip>
);
Expand Down
7 changes: 1 addition & 6 deletions packages/material-ui-lab/src/Autocomplete/Autocomplete.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import * as React from 'react';
import { StandardProps } from '@material-ui/core';
import { PopperProps } from '@material-ui/core/Popper';
import { UseAutocompleteProps, CreateFilterOptions, createFilterOptions } from '../useAutocomplete';

export { createFilterOptions };

export interface PopperProps extends React.HTMLAttributes<HTMLElement> {
anchorEl?: HTMLElement;
open: boolean;
popperRef: React.Ref<unknown>;
}

export interface RenderOptionState {
inputValue: string;
selected: boolean;
Expand Down
9 changes: 1 addition & 8 deletions packages/material-ui-lab/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const styles = theme => ({

function DisablePortal(props) {
// eslint-disable-next-line react/prop-types
const { popperRef, anchorEl, open, ...other } = props;
const { anchorEl, open, ...other } = props;
return <div {...other} />;
}

Expand Down Expand Up @@ -267,12 +267,6 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) {
} = props;
/* eslint-enable no-unused-vars */

const popperRef = React.useRef(null);
React.useEffect(() => {
if (popperRef.current) {
popperRef.current.update();
}
});
const PopperComponent = disablePortal ? DisablePortal : PopperComponentProp;

const {
Expand Down Expand Up @@ -412,7 +406,6 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) {
width: anchorEl ? anchorEl.clientWidth : null,
}}
role="presentation"
popperRef={popperRef}
anchorEl={anchorEl}
open
>
Expand Down
6 changes: 6 additions & 0 deletions packages/material-ui/src/Popper/Popper.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ const Popper = React.forwardRef(function Popper(props, ref) {
*/
const [placement, setPlacement] = React.useState(rtlPlacement);

React.useEffect(() => {
if (popperRef.current) {
popperRef.current.update();
}
});

const handleOpen = React.useCallback(() => {
if (!tooltipRef.current || !anchorEl || !open) {
return;
Expand Down
7 changes: 0 additions & 7 deletions packages/material-ui/src/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,6 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
} = props;
const theme = useTheme();

const popperRef = React.useRef(null);
React.useEffect(() => {
if (popperRef.current) {
popperRef.current.update();
}
});

const [childNode, setChildNode] = React.useState();
const [arrowRef, setArrowRef] = React.useState(null);
const ignoreNonTouchEvents = React.useRef(false);
Expand Down

0 comments on commit f10d116

Please sign in to comment.