From 24037ddd592d170db52f74f2d70a06bd05d0a335 Mon Sep 17 00:00:00 2001 From: Adela Almasan <88068998+adela-almasan@users.noreply.github.com> Date: Fri, 12 May 2023 18:37:43 -0500 Subject: [PATCH] ResourcePicker: Fix selecting icons (#68419) --- public/app/features/dimensions/editors/ResourceCards.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/features/dimensions/editors/ResourceCards.tsx b/public/app/features/dimensions/editors/ResourceCards.tsx index 57d01604cda..dcd32994cc7 100644 --- a/public/app/features/dimensions/editors/ResourceCards.tsx +++ b/public/app/features/dimensions/editors/ResourceCards.tsx @@ -21,7 +21,7 @@ interface CellProps { }; } -function Cell(props: CellProps) { +const MemoizedCell = memo(function Cell(props: CellProps) { const { columnIndex, rowIndex, style, data } = props; const { cards, columnCount, onChange, selected } = data; const singleColumnIndex = columnIndex + rowIndex * columnCount; @@ -47,7 +47,7 @@ function Cell(props: CellProps) { )} ); -} +}, areEqual); const getStyles = stylesFactory((theme: GrafanaTheme2) => { return { @@ -125,7 +125,7 @@ export const ResourceCards = (props: CardProps) => { itemData={{ cards, columnCount, onChange, selected: value }} className={styles.grid} > - {memo(Cell, areEqual)} + {MemoizedCell} ); }}