You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ly...@apache.org on 2023/01/05 21:58:19 UTC

[superset] 06/07: Cancel now redirects to the previous page

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d71d628cf9eee1818efd2fbf21d2d4f18b7b2a37
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Jan 3 18:53:10 2023 -0600

    Cancel now redirects to the previous page
---
 .../src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx      | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
index 8fa4d6976f..25bbeb780f 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
@@ -17,6 +17,7 @@
  * under the License.
  */
 import React from 'react';
+import { useHistory } from 'react-router-dom';
 import Button from 'src/components/Button';
 import { t } from '@superset-ui/core';
 import { useSingleViewResource } from 'src/views/CRUD/hooks';
@@ -49,12 +50,12 @@ const LOG_ACTIONS = [
 ];
 
 function Footer({
-  url,
   datasetObject,
   addDangerToast,
   hasColumns = false,
   datasets,
 }: FooterProps) {
+  const history = useHistory();
   const { createResource } = useSingleViewResource<Partial<DatasetObject>>(
     'dataset',
     t('dataset'),
@@ -72,11 +73,7 @@ function Footer({
 
     return LOG_ACTIONS[value];
   };
-  const goToPreviousUrl = () => {
-    // this is a placeholder url until the final feature gets implemented
-    // at that point we will be passing in the url of the previous location.
-    window.location.href = url;
-  };
+  const goToPreviousUrl = () => history.goBack();
 
   const cancelButtonOnClick = () => {
     if (!datasetObject) {