add check for table

This commit is contained in:
Tim Chamberlain
2023-09-22 09:46:00 -05:00
parent 25599d0ca6
commit e351883d73

View File

@ -90,7 +90,11 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
{ {
const processNameParam = useParams().processName; const processNameParam = useParams().processName;
const processName = process === null ? processNameParam : process.name; const processName = process === null ? processNameParam : process.name;
const tableVariantLocalStorageKey = `${TABLE_VARIANT_LOCAL_STORAGE_KEY_ROOT}.${table.name}`; let tableVariantLocalStorageKey: string | null = null;
if(table)
{
tableVariantLocalStorageKey = `${TABLE_VARIANT_LOCAL_STORAGE_KEY_ROOT}.${table.name}`;
}
/////////////////// ///////////////////
// process state // // process state //
@ -1105,7 +1109,7 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
} }
} }
if (localStorage.getItem(tableVariantLocalStorageKey)) if (tableVariantLocalStorageKey && localStorage.getItem(tableVariantLocalStorageKey))
{ {
let tableVariant = JSON.parse(localStorage.getItem(tableVariantLocalStorageKey)); let tableVariant = JSON.parse(localStorage.getItem(tableVariantLocalStorageKey));
queryStringPairsForInit.push(`tableVariant=${JSON.stringify(tableVariant)}`); queryStringPairsForInit.push(`tableVariant=${JSON.stringify(tableVariant)}`);
@ -1196,7 +1200,7 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
formData.append(key, values[key]); formData.append(key, values[key]);
}); });
if (localStorage.getItem(tableVariantLocalStorageKey)) if (tableVariantLocalStorageKey && localStorage.getItem(tableVariantLocalStorageKey))
{ {
let tableVariant = JSON.parse(localStorage.getItem(tableVariantLocalStorageKey)); let tableVariant = JSON.parse(localStorage.getItem(tableVariantLocalStorageKey));
formData.append("tableVariant", JSON.stringify(tableVariant)); formData.append("tableVariant", JSON.stringify(tableVariant));