From 0f6d603c1e5918f0606581bd8ec82e931f0e5370 Mon Sep 17 00:00:00 2001 From: Titani Date: Mon, 18 Nov 2024 14:25:32 -0500 Subject: [PATCH 1/2] fix(Toolbar): Fixed null exception in Toolbar filter --- packages/react-core/src/components/Toolbar/ToolbarFilter.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx b/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx index 84de82f41a0..54934aeb524 100644 --- a/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx +++ b/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx @@ -133,7 +133,10 @@ class ToolbarFilter extends React.Component {showToolbarItem && {children}} - {ReactDOM.createPortal(labelGroup, labelGroupContentRef.current.firstElementChild)} + {labelGroupContentRef && + labelGroupContentRef?.current !== null && + labelGroupContentRef.current?.firstElementChild !== null && + ReactDOM.createPortal(labelGroup, labelGroupContentRef.current.firstElementChild)} ); } From 4be50c9e091e4b80d55ada0c0b4be3be67240b4a Mon Sep 17 00:00:00 2001 From: Titani Date: Wed, 20 Nov 2024 11:57:50 -0500 Subject: [PATCH 2/2] Updates form review comments --- packages/react-core/src/components/Toolbar/ToolbarFilter.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx b/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx index 54934aeb524..d2cd7d3cbd4 100644 --- a/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx +++ b/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx @@ -133,9 +133,7 @@ class ToolbarFilter extends React.Component {showToolbarItem && {children}} - {labelGroupContentRef && - labelGroupContentRef?.current !== null && - labelGroupContentRef.current?.firstElementChild !== null && + {labelGroupContentRef?.current?.firstElementChild !== null && ReactDOM.createPortal(labelGroup, labelGroupContentRef.current.firstElementChild)} );