From 99de8a49b640ada2006b85cf97376c84a0de449a Mon Sep 17 00:00:00 2001 From: Duy Nguyen Hoang Date: Sun, 10 Jan 2021 04:32:06 +0700 Subject: [PATCH] fix: explore replace wrong standalone slice url (#12359) --- .gitignore | 2 ++ .../spec/javascripts/explore/utils_spec.jsx | 10 ++++++++++ .../src/explore/components/ExploreViewContainer.jsx | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 175e7e78ba..e8d8bb2ae5 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,8 @@ *.swp __pycache__ +.local +.cache .bento* .cache-loader .coverage diff --git a/superset-frontend/spec/javascripts/explore/utils_spec.jsx b/superset-frontend/spec/javascripts/explore/utils_spec.jsx index 251475a215..9214400a10 100644 --- a/superset-frontend/spec/javascripts/explore/utils_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/utils_spec.jsx @@ -199,6 +199,16 @@ describe('exploreUtils', () => { URI('/superset/explore/').search({ form_data: sFormData }), ); }); + + it('generates url with standalone', () => { + compareURI( + URI(getExploreLongUrl(formData, 'standalone')), + URI('/superset/explore/').search({ + form_data: sFormData, + standalone: 'true', + }), + ); + }); }); describe('buildV1ChartDataPayload', () => { diff --git a/superset-frontend/src/explore/components/ExploreViewContainer.jsx b/superset-frontend/src/explore/components/ExploreViewContainer.jsx index c5390563fe..2cfe9f8d70 100644 --- a/superset-frontend/src/explore/components/ExploreViewContainer.jsx +++ b/superset-frontend/src/explore/components/ExploreViewContainer.jsx @@ -169,7 +169,11 @@ function ExploreViewContainer(props) { function addHistory({ isReplace = false, title } = {}) { const payload = { ...props.form_data }; - const longUrl = getExploreLongUrl(props.form_data, null, false); + const longUrl = getExploreLongUrl( + props.form_data, + props.standalone ? 'standalone' : null, + false, + ); try { if (isReplace) { window.history.replaceState(payload, title, longUrl);