From 406888d9aad8dab637cf4c2f50f42941ac157a5a Mon Sep 17 00:00:00 2001 From: Alex Khomenko Date: Mon, 16 Oct 2023 14:25:09 +0200 Subject: [PATCH] Stack: Filter out undefined children (#76617) --- packages/grafana-ui/src/components/Layout/Stack/Stack.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/grafana-ui/src/components/Layout/Stack/Stack.tsx b/packages/grafana-ui/src/components/Layout/Stack/Stack.tsx index 848ff8bd01a..2e24f2332f9 100644 --- a/packages/grafana-ui/src/components/Layout/Stack/Stack.tsx +++ b/packages/grafana-ui/src/components/Layout/Stack/Stack.tsx @@ -13,9 +13,11 @@ export const Stack = React.forwardRef { return ( - {React.Children.map(children, (child) => ( -
{child}
- ))} + {React.Children.toArray(children) + .filter(Boolean) + .map((child, index) => ( +
{child}
+ ))}
); }