From abd9e86fe6a97f11650f2821e71686fa2170ea94 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 17:33:51 +0300 Subject: [PATCH] [v11.1.x] Table: Fix state bug with initialRowIndex (#90370) Table: Fix state bug with initialRowIndex (#90308) * fix: fix state bug --------- Co-authored-by: nmarrs (cherry picked from commit 8400b54a53ddb6586785cd4634de9cd388634a8b) Co-authored-by: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com> --- packages/grafana-ui/src/components/Table/RowsList.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/grafana-ui/src/components/Table/RowsList.tsx b/packages/grafana-ui/src/components/Table/RowsList.tsx index b994f18b541..26424abd922 100644 --- a/packages/grafana-ui/src/components/Table/RowsList.tsx +++ b/packages/grafana-ui/src/components/Table/RowsList.tsx @@ -80,6 +80,9 @@ export const RowsList = (props: RowsListProps) => { } = props; const [rowHighlightIndex, setRowHighlightIndex] = useState(initialRowIndex); + if (initialRowIndex === undefined && rowHighlightIndex !== undefined) { + setRowHighlightIndex(undefined); + } const theme = useTheme2(); const panelContext = usePanelContext();