From 42f6a0a6fce9675d7b4a54f0246bf682fd058f21 Mon Sep 17 00:00:00 2001 From: mikebender Date: Fri, 2 Jun 2023 11:33:45 -0400 Subject: [PATCH] fix: Add a default DashboardPanelWrapper - Fixes an issue introduced with #1329 - Wasn't using a stable function as the default wrapper function --- packages/dashboard/src/DashboardLayout.tsx | 4 ++-- packages/dashboard/src/DashboardPanelWrapper.tsx | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 packages/dashboard/src/DashboardPanelWrapper.tsx diff --git a/packages/dashboard/src/DashboardLayout.tsx b/packages/dashboard/src/DashboardLayout.tsx index 2873a5fdb1..a4c2fa7ff0 100644 --- a/packages/dashboard/src/DashboardLayout.tsx +++ b/packages/dashboard/src/DashboardLayout.tsx @@ -33,6 +33,7 @@ import { PanelHydrateFunction, PanelProps, } from './DashboardPlugin'; +import DashboardPanelWrapper from './DashboardPanelWrapper'; export type DashboardLayoutConfig = ItemConfigType[]; @@ -82,8 +83,7 @@ export function DashboardLayout({ onLayoutInitialized = DEFAULT_CALLBACK, hydrate = hydrateDefault, dehydrate = dehydrateDefault, - // eslint-disable-next-line react/jsx-no-useless-fragment - panelWrapper = ({ children: panelChildren }) => <>{panelChildren}, + panelWrapper = DashboardPanelWrapper, }: DashboardLayoutProps): JSX.Element { const dispatch = useDispatch(); const data = diff --git a/packages/dashboard/src/DashboardPanelWrapper.tsx b/packages/dashboard/src/DashboardPanelWrapper.tsx new file mode 100644 index 0000000000..61b08d184a --- /dev/null +++ b/packages/dashboard/src/DashboardPanelWrapper.tsx @@ -0,0 +1,8 @@ +import React, { PropsWithChildren } from 'react'; + +export function DashboardPanelWrapper({ children }: PropsWithChildren) { + // eslint-disable-next-line react/jsx-no-useless-fragment + return <>{children}; +} + +export default DashboardPanelWrapper;