diff --git a/frontend/javascripts/admin/dataset/dataset_add_remote_view.tsx b/frontend/javascripts/admin/dataset/dataset_add_remote_view.tsx index 33c4801c78..847e720282 100644 --- a/frontend/javascripts/admin/dataset/dataset_add_remote_view.tsx +++ b/frontend/javascripts/admin/dataset/dataset_add_remote_view.tsx @@ -252,13 +252,13 @@ function DatasetAddRemoteView(props: Props) { form.setFieldsValue({ dataSourceJson }); // Since this function sets the JSON string, we have to update the // data which is rendered by the "simple" page. - syncDataSourceFields(form, "simple"); + syncDataSourceFields(form, "simple", true); form.validateFields(); }; async function handleStoreDataset() { // Sync simple with advanced and get newest datasourceJson - syncDataSourceFields(form, dataSourceEditMode === "simple" ? "advanced" : "simple"); + syncDataSourceFields(form, dataSourceEditMode === "simple" ? "advanced" : "simple", true); try { await form.validateFields(); } catch (_e) { @@ -515,7 +515,7 @@ function AddRemoteLayer({ } // Sync simple with advanced and get newest datasourceJson - syncDataSourceFields(form, dataSourceEditMode === "simple" ? "advanced" : "simple"); + syncDataSourceFields(form, dataSourceEditMode === "simple" ? "advanced" : "simple", true); const datasourceConfigStr = form.getFieldValue("dataSourceJson"); const datastoreToUse = uploadableDatastores.find( (datastore) => form.getFieldValue("datastoreUrl") === datastore.url, diff --git a/frontend/javascripts/dashboard/dataset/dataset_settings_data_tab.tsx b/frontend/javascripts/dashboard/dataset/dataset_settings_data_tab.tsx index ab4d65a60f..2650c4e136 100644 --- a/frontend/javascripts/dashboard/dataset/dataset_settings_data_tab.tsx +++ b/frontend/javascripts/dashboard/dataset/dataset_settings_data_tab.tsx @@ -51,7 +51,7 @@ export const syncDataSourceFields = ( if (syncTargetTabKey === "advanced") { // Copy from simple to advanced: update json const dataSourceFromSimpleTab = form.getFieldValue("dataSource"); - if (syncDatasetName) { + if (syncDatasetName && dataSourceFromSimpleTab) { dataSourceFromSimpleTab.id ??= {}; dataSourceFromSimpleTab.id.name = form.getFieldValue(["dataset", "name"]); }