From 882308c4bec2a1e0895fcdb38e27adf6534f4ff9 Mon Sep 17 00:00:00 2001 From: Zachary Stence Date: Fri, 19 Jul 2024 17:27:26 -0500 Subject: [PATCH] fix: checkInputs allows for data without column metadata if we have data --- .../lib/component-utilities/src/checkInputs.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/lib/component-utilities/src/checkInputs.js b/packages/lib/component-utilities/src/checkInputs.js index a555909063..439931667e 100644 --- a/packages/lib/component-utilities/src/checkInputs.js +++ b/packages/lib/component-utilities/src/checkInputs.js @@ -55,8 +55,18 @@ export default function checkInputs(data, reqCols, optCols) { // Get list of all columns in dataset if (Query.isQuery(data)) { - for (const col of data.columns) { - columns.push(col.column_name); + // we want to handle cases where the columns have not yet been fetched, but the data is avialable + // this is most likely to happen during pre-rendering, because column metadata is not yet included + // in the prerendering process + if (!data.columnsLoaded && data.dataLoaded) { + const cols = Object.keys(data[0]); + for (const col of cols) { + columns.push(col); + } + } else { + for (const col of data.columns) { + columns.push(col.column_name); + } } } else { for (const key of Object.keys(data[0])) {