This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new c5d23fb  fix: Unable to add dataset (#16925)
c5d23fb is described below

commit c5d23fbcc7f3d27aa8ada5e144ec1e9c7e367623
Author: Michael S. Molina <[email protected]>
AuthorDate: Thu Sep 30 14:52:48 2021 -0300

    fix: Unable to add dataset (#16925)
---
 .../src/views/CRUD/data/dataset/AddDatasetModal.tsx              | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx 
b/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx
index 527b92a..80debef 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import React, { FunctionComponent, useState } from 'react';
+import React, { FunctionComponent, useState, useEffect } from 'react';
 import { styled, t } from '@superset-ui/core';
 import { useSingleViewResource } from 'src/views/CRUD/hooks';
 import { isEmpty, isNil } from 'lodash';
@@ -60,9 +60,9 @@ const DatasetModal: FunctionComponent<DatasetModalProps> = ({
     addDangerToast,
   );
 
-  const setSaveButtonState = () => {
+  useEffect(() => {
     setDisableSave(isNil(datasourceId) || isEmpty(currentTableName));
-  };
+  }, [currentTableName, datasourceId]);
 
   const onDbChange = (db: {
     id: number;
@@ -70,17 +70,14 @@ const DatasetModal: FunctionComponent<DatasetModalProps> = 
({
     backend: string;
   }) => {
     setDatasourceId(db.id);
-    setSaveButtonState();
   };
 
   const onSchemaChange = (schema?: string) => {
     setSchema(schema);
-    setSaveButtonState();
   };
 
   const onTableChange = (tableName: string) => {
     setTableName(tableName);
-    setSaveButtonState();
   };
 
   const onSave = () => {

Reply via email to