Fix empty gridLabel fallback in dynamic grid dimensions

When gridLabel is an empty string "", fall back to pathLabel instead
of showing an empty header. The check was only for undefined, not
for empty strings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2026-01-16 17:00:57 -06:00
parent c6a8d5d1d8
commit 70ee13404c

View File

@@ -1496,7 +1496,8 @@ export function inferGridDimensionsFromExamples(
for (const pathLabel of dim1Info.uniqueValues) {
const gridLabel = dim1Info.gridLabels.get(pathLabel)
rows.push(gridLabel !== undefined ? gridLabel : pathLabel)
// Use gridLabel if it's a non-empty string, otherwise fall back to pathLabel
rows.push(gridLabel ? gridLabel : pathLabel)
rowKeys.push(pathLabel)
}
@@ -1543,13 +1544,15 @@ export function inferGridDimensionsFromExamples(
for (const pathLabel of rowInfo.uniqueValues) {
const gridLabel = rowInfo.gridLabels.get(pathLabel)
rows.push(gridLabel !== undefined ? gridLabel : pathLabel)
// Use gridLabel if it's a non-empty string, otherwise fall back to pathLabel
rows.push(gridLabel ? gridLabel : pathLabel)
rowKeys.push(pathLabel)
}
for (const pathLabel of colInfo.uniqueValues) {
const gridLabel = colInfo.gridLabels.get(pathLabel)
cols.push(gridLabel !== undefined ? gridLabel : pathLabel)
// Use gridLabel if it's a non-empty string, otherwise fall back to pathLabel
cols.push(gridLabel ? gridLabel : pathLabel)
colKeys.push(pathLabel)
}