mirror of
https://github.com/apache/superset.git
synced 2024-09-16 02:29:39 -04:00
fix(explore): ignore temporary controls in altered pill (#19843)
This commit is contained in:
parent
ae384111c1
commit
2dafff12ef
@ -69,6 +69,17 @@ describe('AlteredSliceTag', () => {
|
|||||||
expect(wrapper.instance().render()).toBeNull();
|
expect(wrapper.instance().render()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not run when temporary controls have changes', () => {
|
||||||
|
props = {
|
||||||
|
origFormData: { ...props.origFormData, url_params: { foo: 'foo' } },
|
||||||
|
currentFormData: { ...props.origFormData, url_params: { bar: 'bar' } },
|
||||||
|
};
|
||||||
|
wrapper = mount(<AlteredSliceTag {...props} />);
|
||||||
|
expect(wrapper.instance().state.rows).toEqual([]);
|
||||||
|
expect(wrapper.instance().state.hasDiffs).toBe(false);
|
||||||
|
expect(wrapper.instance().render()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
it('sets new rows when receiving new props', () => {
|
it('sets new rows when receiving new props', () => {
|
||||||
const testRows = ['testValue'];
|
const testRows = ['testValue'];
|
||||||
const getRowsFromDiffsStub = jest
|
const getRowsFromDiffsStub = jest
|
||||||
|
@ -20,6 +20,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { isEqual, isEmpty } from 'lodash';
|
import { isEqual, isEmpty } from 'lodash';
|
||||||
import { t } from '@superset-ui/core';
|
import { t } from '@superset-ui/core';
|
||||||
|
import { sanitizeFormData } from 'src/explore/exploreUtils/formData';
|
||||||
import getControlsForVizType from 'src/utils/getControlsForVizType';
|
import getControlsForVizType from 'src/utils/getControlsForVizType';
|
||||||
import { safeStringify } from 'src/utils/safeStringify';
|
import { safeStringify } from 'src/utils/safeStringify';
|
||||||
import { Tooltip } from 'src/components/Tooltip';
|
import { Tooltip } from 'src/components/Tooltip';
|
||||||
@ -82,8 +83,8 @@ export default class AlteredSliceTag extends React.Component {
|
|||||||
getDiffs(props) {
|
getDiffs(props) {
|
||||||
// Returns all properties that differ in the
|
// Returns all properties that differ in the
|
||||||
// current form data and the saved form data
|
// current form data and the saved form data
|
||||||
const ofd = props.origFormData;
|
const ofd = sanitizeFormData(props.origFormData);
|
||||||
const cfd = props.currentFormData;
|
const cfd = sanitizeFormData(props.currentFormData);
|
||||||
|
|
||||||
const fdKeys = Object.keys(cfd);
|
const fdKeys = Object.keys(cfd);
|
||||||
const diffs = {};
|
const diffs = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user