Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(explore): Re-enable Explore re-render on Save As #20704

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { HEALTH_POP_FORM_DATA_DEFAULTS } from './visualizations/shared.helper';
const apiURL = (endpoint: string, queryObject: Record<string, unknown>) =>
`${endpoint}?q=${rison.encode(queryObject)}`;

describe.skip('Test explore links', () => {
describe('Test explore links', () => {
beforeEach(() => {
cy.login();
interceptChart({ legacy: true }).as('chartData');
Expand Down
9 changes: 8 additions & 1 deletion superset-frontend/src/datasource/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ import {
DatasourcesActionType,
} from 'src/datasource/actions';
import { Dataset } from '@superset-ui/chart-controls';
import {
HydrateExplore,
HYDRATE_EXPLORE,
} from 'src/explore/actions/hydrateExplore';

export default function datasourcesReducer(
datasources: { [key: string]: Dataset } | undefined,
action: DatasourcesAction,
action: DatasourcesAction | HydrateExplore,
) {
if (action.type === DatasourcesActionType.INIT_DATASOURCES) {
return { ...action.datasources };
Expand All @@ -43,5 +47,8 @@ export default function datasourcesReducer(
[getDatasourceUid(action.datasource)]: action.datasource,
};
}
if (action.type === HYDRATE_EXPLORE) {
return { ...(action as HydrateExplore).data.datasources };
}
return datasources || {};
}
13 changes: 13 additions & 0 deletions superset-frontend/src/explore/actions/hydrateExplore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ test('creates hydrate action from initial data', () => {
lastRendered: 0,
},
},
datasources: {
'8__table': {
column_format: {},
columns: [{ column_name: 'a' }],
datasource_name: '8__table',
description: null,
id: 8,
main_dttm_col: '',
metrics: [{ metric_name: 'first' }, { metric_name: 'second' }],
type: 'table',
verbose_map: {},
},
},
saveModal: {
dashboards: [],
saveModalAlert: null,
Expand Down
12 changes: 4 additions & 8 deletions superset-frontend/src/explore/actions/hydrateExplore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { getDatasourceUid } from 'src/utils/getDatasourceUid';
import { getUrlParam } from 'src/utils/urlUtils';
import { URL_PARAMS } from 'src/constants';
import { findPermission } from 'src/utils/findPermission';
import { initDatasources } from 'src/datasource/actions';

export const HYDRATE_EXPLORE = 'HYDRATE_EXPLORE';
export const hydrateExplore =
Expand Down Expand Up @@ -121,20 +120,17 @@ export const hydrateExplore =
lastRendered: 0,
};

dispatch(
initDatasources({
...datasources,
[getDatasourceUid(initialDatasource)]: initialDatasource,
}),
);

return dispatch({
type: HYDRATE_EXPLORE,
data: {
charts: {
...charts,
[chartKey]: chart,
},
datasources: {
...datasources,
[getDatasourceUid(initialDatasource)]: initialDatasource,
},
saveModal: {
dashboards: [],
saveModalAlert: null,
Expand Down