Skip to content

Commit

Permalink
fix(dashboard): JS error when editing charts (#21422)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud authored Sep 12, 2022
1 parent d28909d commit 1084bde
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions superset-frontend/src/explore/ExplorePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,20 @@ const fetchExploreData = async (exploreUrlParams: URLSearchParams) => {
}
};

const getDashboardPageContext = (pageId?: string | null) => {
if (!pageId) {
return null;
}
return (
getItem(LocalStorageKeys.dashboard__explore_context, {})[pageId] || null
);
};

const getDashboardContextFormData = () => {
const dashboardPageId = getUrlParam(URL_PARAMS.dashboardPageId);
const sliceId = getUrlParam(URL_PARAMS.sliceId) || 0;
let dashboardContextWithFilters = {};
if (dashboardPageId) {
const dashboardContext = getDashboardPageContext(dashboardPageId);
if (dashboardContext) {
const sliceId = getUrlParam(URL_PARAMS.sliceId) || 0;
const {
labelColors,
sharedLabelColors,
Expand All @@ -75,11 +84,8 @@ const getDashboardContextFormData = () => {
filterBoxFilters,
dataMask,
dashboardId,
} =
getItem(LocalStorageKeys.dashboard__explore_context, {})[
dashboardPageId
] || {};
dashboardContextWithFilters = getFormDataWithExtraFilters({
} = dashboardContext;
const dashboardContextWithFilters = getFormDataWithExtraFilters({
chart: { id: sliceId },
filters: getAppliedFilterValues(sliceId, filterBoxFilters),
nativeFilters,
Expand Down

0 comments on commit 1084bde

Please sign in to comment.