Skip to content

Commit

Permalink
fix(expandable section): Fix uncaught exception (patternfly#10659)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlabaj authored Jul 8, 2024
1 parent 63e4039 commit 5925ef1
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,12 @@ class ExpandableSection extends React.Component<ExpandableSectionProps, Expandab
};

resize = () => {
const { offsetWidth } = this.expandableContentRef.current;
if (this.state.previousWidth !== offsetWidth) {
this.setState({ previousWidth: offsetWidth });
this.checkToggleVisibility();
if (this.expandableContentRef) {
const { offsetWidth } = this.expandableContentRef.current;
if (this.state.previousWidth !== offsetWidth) {
this.setState({ previousWidth: offsetWidth });
this.checkToggleVisibility();
}
}
};
handleResize = debounce(this.resize, 250);
Expand Down

0 comments on commit 5925ef1

Please sign in to comment.