diff --git a/spiffworkflow-frontend/src/components/DataStoreForm.tsx b/spiffworkflow-frontend/src/components/DataStoreForm.tsx index fde106f58..18585c699 100644 --- a/spiffworkflow-frontend/src/components/DataStoreForm.tsx +++ b/spiffworkflow-frontend/src/components/DataStoreForm.tsx @@ -155,8 +155,14 @@ export default function DataStoreForm({ const onTypeChanged = (newType: any) => { setTypeInvalid(false); const newTypeSelection = newType.selectedItem; - const updateDict = { type: newTypeSelection.type }; - updateDataStore(updateDict); + if ( + newTypeSelection && + typeof newTypeSelection === 'object' && + 'type' in newTypeSelection + ) { + const updateDict = { type: newTypeSelection.type }; + updateDataStore(updateDict); + } setSelectedDataStoreType(newTypeSelection); }; @@ -166,6 +172,18 @@ export default function DataStoreForm({ updateDataStore(updateDict); }; + const dataStoreTypeDisplayString = ( + dataStoreType: DataStoreType | null + ): string => { + if (dataStoreType) { + return `${dataStoreType.name} (${truncateString( + dataStoreType.description, + 75 + )})`; + } + return ''; + }; + const formElements = () => { const textInputs = [ ); - textInputs.push( - { - if (dataStoreType) { - return `${dataStoreType.name} (${truncateString( - dataStoreType.description, - 75 - )})`; - } - return null; - }} - titleText="Type*" - invalidText="Type is required." - invalid={typeInvalid} - placeholder="Choose the data store type" - selectedItem={selectedDataStoreType} - /> - ); + if (mode === 'edit') { + textInputs.push( + + ); + } else { + textInputs.push( + + ); + } textInputs.push(