You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/10/08 22:53:09 UTC

[GitHub] [superset] betodealmeida commented on a change in pull request #17044: fix: clear modal state after adding dataset

betodealmeida commented on a change in pull request #17044:
URL: https://github.com/apache/superset/pull/17044#discussion_r725358410



##########
File path: superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx
##########
@@ -80,9 +79,21 @@ const DatasetModal: FunctionComponent<DatasetModalProps> = ({
     setTableName(tableName);
   };
 
+  const clearModal = () => {
+    setSchema('');
+    setTableName('');
+    setCurrentDatabase(undefined);
+    setDisableSave(true);
+  };
+
+  const hide = () => {
+    clearModal();
+    onHide();
+  };
+
   const onSave = () => {
     const data = {
-      database: datasourceId,
+      database: currentDatabase?.id || 0,

Review comment:
       Let me clean this up... here `currentDatabase` will always be defined, otherwise you can't save.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org