[v10.0.x] ResourcePicker: Fix selecting icons (#68422)

ResourcePicker: Fix selecting icons (#68419)

(cherry picked from commit 24037ddd59)

Co-authored-by: Adela Almasan <88068998+adela-almasan@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2023-05-12 17:12:23 -07:00
committed by GitHub
co-authored by Adela Almasan
parent 0a4f4c1951
commit f2593ec7af
@@ -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) {
)}
</div>
);
}
}, 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}
</Grid>
);
}}