fix: explore replace wrong standalone slice url (#12359)

This commit is contained in:
Duy Nguyen Hoang 2021-01-10 04:32:06 +07:00 committed by GitHub
parent 3eb0470a2f
commit 99de8a49b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

2
.gitignore vendored
View File

@ -22,6 +22,8 @@
*.swp
__pycache__
.local
.cache
.bento*
.cache-loader
.coverage

View File

@ -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', () => {

View File

@ -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);