From f7705b162ba8000dfcaac4177ffe86b656f9e058 Mon Sep 17 00:00:00 2001 From: Titani Date: Tue, 25 Jun 2024 16:47:05 -0400 Subject: [PATCH] fix(expandable section): Fix uncaught exception --- .../components/ExpandableSection/ExpandableSection.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react-core/src/components/ExpandableSection/ExpandableSection.tsx b/packages/react-core/src/components/ExpandableSection/ExpandableSection.tsx index 1ac95089bbb..6c93a95a6c6 100644 --- a/packages/react-core/src/components/ExpandableSection/ExpandableSection.tsx +++ b/packages/react-core/src/components/ExpandableSection/ExpandableSection.tsx @@ -171,10 +171,12 @@ class ExpandableSection extends React.Component { - 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);