Skip to content

Commit f10d116

Browse files
remove dead code
1 parent 146f40d commit f10d116

File tree

6 files changed

+10
-54
lines changed

6 files changed

+10
-54
lines changed

docs/src/pages/components/slider/CustomizedSlider.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,8 @@ const useStyles = makeStyles(theme => ({
1717
function ValueLabelComponent(props) {
1818
const { children, open, value } = props;
1919

20-
const popperRef = React.useRef(null);
21-
React.useEffect(() => {
22-
if (popperRef.current) {
23-
popperRef.current.update();
24-
}
25-
});
26-
2720
return (
28-
<Tooltip
29-
PopperProps={{
30-
popperRef,
31-
}}
32-
open={open}
33-
enterTouchDelay={0}
34-
placement="top"
35-
title={value}
36-
>
21+
<Tooltip open={open} enterTouchDelay={0} placement="top" title={value}>
3722
{children}
3823
</Tooltip>
3924
);

docs/src/pages/components/slider/CustomizedSlider.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { withStyles, makeStyles, Theme, createStyles } from '@material-ui/core/s
33
import Slider from '@material-ui/core/Slider';
44
import Typography from '@material-ui/core/Typography';
55
import Tooltip from '@material-ui/core/Tooltip';
6-
import PopperJs from 'popper.js';
76

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

28-
const popperRef = React.useRef<PopperJs | null>(null);
29-
React.useEffect(() => {
30-
if (popperRef.current) {
31-
popperRef.current.update();
32-
}
33-
});
34-
3527
return (
36-
<Tooltip
37-
PopperProps={{
38-
popperRef,
39-
}}
40-
open={open}
41-
enterTouchDelay={0}
42-
placement="top"
43-
title={value}
44-
>
28+
<Tooltip open={open} enterTouchDelay={0} placement="top" title={value}>
4529
{children}
4630
</Tooltip>
4731
);

packages/material-ui-lab/src/Autocomplete/Autocomplete.d.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import * as React from 'react';
22
import { StandardProps } from '@material-ui/core';
3+
import { PopperProps } from '@material-ui/core/Popper';
34
import { UseAutocompleteProps, CreateFilterOptions, createFilterOptions } from '../useAutocomplete';
45

56
export { createFilterOptions };
67

7-
export interface PopperProps extends React.HTMLAttributes<HTMLElement> {
8-
anchorEl?: HTMLElement;
9-
open: boolean;
10-
popperRef: React.Ref<unknown>;
11-
}
12-
138
export interface RenderOptionState {
149
inputValue: string;
1510
selected: boolean;

packages/material-ui-lab/src/Autocomplete/Autocomplete.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export const styles = theme => ({
208208

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

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

270-
const popperRef = React.useRef(null);
271-
React.useEffect(() => {
272-
if (popperRef.current) {
273-
popperRef.current.update();
274-
}
275-
});
276270
const PopperComponent = disablePortal ? DisablePortal : PopperComponentProp;
277271

278272
const {
@@ -412,7 +406,6 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) {
412406
width: anchorEl ? anchorEl.clientWidth : null,
413407
}}
414408
role="presentation"
415-
popperRef={popperRef}
416409
anchorEl={anchorEl}
417410
open
418411
>

packages/material-ui/src/Popper/Popper.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ const Popper = React.forwardRef(function Popper(props, ref) {
7777
*/
7878
const [placement, setPlacement] = React.useState(rtlPlacement);
7979

80+
React.useEffect(() => {
81+
if (popperRef.current) {
82+
popperRef.current.update();
83+
}
84+
});
85+
8086
const handleOpen = React.useCallback(() => {
8187
if (!tooltipRef.current || !anchorEl || !open) {
8288
return;

packages/material-ui/src/Tooltip/Tooltip.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,6 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
200200
} = props;
201201
const theme = useTheme();
202202

203-
const popperRef = React.useRef(null);
204-
React.useEffect(() => {
205-
if (popperRef.current) {
206-
popperRef.current.update();
207-
}
208-
});
209-
210203
const [childNode, setChildNode] = React.useState();
211204
const [arrowRef, setArrowRef] = React.useState(null);
212205
const ignoreNonTouchEvents = React.useRef(false);

0 commit comments

Comments
 (0)