From 3b37be93e935febf4208b04aa04bcf9feb545bcd Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:57:20 +0300 Subject: [PATCH] [v11.2.x] Table: Fix edge case where text wrapping crashes on undefined header widths (#91961) Table: Fix edge case where text wrapping crashes on undefined header widths (#91850) Make sure we don't read from header groups if it's undefined (cherry picked from commit 40144eb3c8ff4729e3769dbfd54e94a3947825bd) Co-authored-by: Kyle Cunningham --- packages/grafana-ui/src/components/Table/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/Table/utils.ts b/packages/grafana-ui/src/components/Table/utils.ts index 940734cbd2f..bbd6c66cc13 100644 --- a/packages/grafana-ui/src/components/Table/utils.ts +++ b/packages/grafana-ui/src/components/Table/utils.ts @@ -645,7 +645,7 @@ export function guessTextBoundingBox( lineHeight: number, defaultRowHeight: number ) { - const width = Number(headerGroup.width ?? 300); + const width = Number(headerGroup?.width ?? 300); const LINE_SCALE_FACTOR = 1.17; const LOW_LINE_PAD = 42;