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/19 16:36:04 UTC
[superset] 10/21: Use useHistory instead of window.location.href
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 66fce367be3a37042a50dfba0cd79e815878d26b
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Mon Jan 9 10:45:55 2023 -0600
Use useHistory instead of window.location.href
---
superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
index 7c73b54339..0906776506 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
@@ -23,6 +23,7 @@ import React, {
useMemo,
useCallback,
} from 'react';
+import { useHistory } from 'react-router-dom';
import rison from 'rison';
import {
createFetchRelated,
@@ -135,6 +136,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
addSuccessToast,
user,
}) => {
+ const history = useHistory();
const {
state: {
loading,
@@ -598,7 +600,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
</>
),
onClick: () => {
- window.location.href = '/dataset/add/';
+ history.push('/dataset/add/');
},
buttonStyle: 'primary',
});