Skip to content

Commit

Permalink
[Tabs] Fix null reference in ScrollbarSize after unmounting (#36485)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdrnf committed Apr 12, 2023
1 parent dd9cdd4 commit 7fd18fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/mui-material/src/Tabs/ScrollbarSize.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import debounce from '../utils/debounce';
import { ownerWindow } from '../utils';
import { ownerWindow, unstable_useEnhancedEffect as useEnhancedEffect } from '../utils';

const styles = {
width: 99,
Expand All @@ -25,7 +25,7 @@ export default function ScrollbarSize(props) {
scrollbarHeight.current = nodeRef.current.offsetHeight - nodeRef.current.clientHeight;
};

React.useEffect(() => {
useEnhancedEffect(() => {
const handleResize = debounce(() => {
const prevHeight = scrollbarHeight.current;
setMeasurements();
Expand Down

0 comments on commit 7fd18fe

Please sign in to comment.