Skip to content

Commit

Permalink
Move unsaved chart id to a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Jun 24, 2022
1 parent adbe5a5 commit eade95e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions superset-frontend/src/explore/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,5 @@ export const FILTER_BOX_TRANSITION_SNOOZE_DURATION = 24 * 60 * 60 * 1000; // 24
export const POPOVER_INITIAL_HEIGHT = 240;
export const POPOVER_INITIAL_WIDTH = 320;
export const UNRESIZABLE_POPOVER_WIDTH = 296;

export const UNSAVED_CHART_ID = 0;
3 changes: 2 additions & 1 deletion superset-frontend/src/explore/exploreUtils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ import { URL_PARAMS } from 'src/constants';
import {
MULTI_OPERATORS,
OPERATOR_ENUM_TO_OPERATOR_TYPE,
UNSAVED_CHART_ID,
} from 'src/explore/constants';
import { DashboardStandaloneMode } from 'src/dashboard/util/constants';

export function getChartKey(explore) {
const { slice, form_data } = explore;
return slice?.slice_id ?? form_data?.slice_id ?? 0;
return slice?.slice_id ?? form_data?.slice_id ?? UNSAVED_CHART_ID;
}

let requestCounter = 0;
Expand Down

0 comments on commit eade95e

Please sign in to comment.