Skip to content

Commit 8459d60

Browse files
committed
Code review
1 parent 5103909 commit 8459d60

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,15 @@ function Tooltip(props) {
148148
// Fallback to this default id when possible.
149149
// Use the random value for client side rendering only.
150150
// We can't use it server-side.
151-
defaultId.current = `mui-tooltip-${Math.round(Math.random() * 1e5)}`;
151+
if (!defaultId.current) {
152+
defaultId.current = `mui-tooltip-${Math.round(Math.random() * 1e5)}`;
153+
}
152154

153155
// Rerender with defaultId and childNode.
154-
if (openProp && !mountedRef.current) {
156+
if (openProp) {
155157
forceUpdate(n => !n);
156158
}
157-
}, [mountedRef, openProp]);
159+
}, [openProp]);
158160

159161
React.useEffect(() => {
160162
return () => {

0 commit comments

Comments
 (0)