diff --git a/public/app/features/dashboard-scene/settings/variables/components/VariableValuesPreview.tsx b/public/app/features/dashboard-scene/settings/variables/components/VariableValuesPreview.tsx index 7527886f524..6a07db679c9 100644 --- a/public/app/features/dashboard-scene/settings/variables/components/VariableValuesPreview.tsx +++ b/public/app/features/dashboard-scene/settings/variables/components/VariableValuesPreview.tsx @@ -28,15 +28,15 @@ VariableValuesPreview.displayName = 'VariableValuesPreview'; function VariableValuesWithPropsPreview({ options }: { options: VariableValueOption[] }) { const styles = useStyles2(getStyles); const data = options.map((o) => ({ label: String(o.label), value: String(o.value), ...o.properties })); - const columns = Object.keys(data[0]).map((id) => ({ id, header: id, sortType: 'alphanumeric' as const })); + // the first item in data may be the "All" option which does not have any extra properties, so we try the 2nd item to determine the column names + const columns = Object.keys(data[1] || data[0]).map((id) => ({ id, header: id, sortType: 'alphanumeric' as const })); return (
Preview of values - {/* TODO: pageSize=20 */} - String(r.value)} pageSize={2} /> + String(r.value)} pageSize={10} />
); }