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

[core] Minor nitpicks #15432

Merged
merged 1 commit into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ function ClickAwayListener(props) {

const nodeRef = React.useRef();
// can be removed once we drop support for non ref forwarding class components
const handleOwnRef = React.useCallback(ref => {
const handleOwnRef = React.useCallback(instance => {
// #StrictMode ready
nodeRef.current = ReactDOM.findDOMNode(ref);
nodeRef.current = ReactDOM.findDOMNode(instance);
}, []);
const handleRef = useForkRef(children.ref, handleOwnRef);

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/MenuList/MenuList.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ const MenuList = React.forwardRef(function MenuList(props, ref) {
}
};

const handleOwnRef = React.useCallback(refArg => {
const handleOwnRef = React.useCallback(instance => {
// #StrictMode ready
listRef.current = ReactDOM.findDOMNode(refArg);
listRef.current = ReactDOM.findDOMNode(instance);
}, []);
const handleRef = useForkRef(handleOwnRef, ref);

Expand Down
5 changes: 3 additions & 2 deletions packages/material-ui/src/Modal/TrapFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ function TrapFocus(props) {
const lastFocus = React.useRef();
const rootRef = React.useRef();
// can be removed once we drop support for non ref forwarding class components
const handleOwnRef = React.useCallback(ref => {
rootRef.current = ReactDOM.findDOMNode(ref);
const handleOwnRef = React.useCallback(instance => {
// #StrictMode ready
rootRef.current = ReactDOM.findDOMNode(instance);
}, []);
const handleRef = useForkRef(children.ref, handleOwnRef);

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/Slide/Slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ const Slide = React.forwardRef(function Slide(props, ref) {
/**
* used in cloneElement(children, { ref: handleRef })
*/
const handleOwnRef = React.useCallback(refArg => {
const handleOwnRef = React.useCallback(instance => {
// #StrictMode ready
childrenRef.current = ReactDOM.findDOMNode(refArg);
childrenRef.current = ReactDOM.findDOMNode(instance);
}, []);
const handleRefIntermediary = useForkRef(children.ref, handleOwnRef);
const handleRef = useForkRef(handleRefIntermediary, ref);
Expand Down
5 changes: 3 additions & 2 deletions packages/material-ui/src/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ function Tooltip(props) {
const leaveTimer = React.useRef();
const touchTimer = React.useRef();
// can be removed once we drop support for non ref forwarding class components
const handleOwnRef = React.useCallback(ref => {
setChildNode(ReactDOM.findDOMNode(ref));
const handleOwnRef = React.useCallback(instance => {
// #StrictMode ready
setChildNode(ReactDOM.findDOMNode(instance));
}, []);
const handleRef = useForkRef(children.ref, handleOwnRef);

Expand Down