You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2022/04/26 08:59:08 UTC

[superset] branch master updated: fix(explore): ignore temporary controls in altered pill (#19843)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 2dafff12ef fix(explore): ignore temporary controls in altered pill (#19843)
2dafff12ef is described below

commit 2dafff12ef78082b8a0448e4b9e26ea6d21745ca
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Tue Apr 26 11:58:47 2022 +0300

    fix(explore): ignore temporary controls in altered pill (#19843)
---
 .../src/components/AlteredSliceTag/AlteredSliceTag.test.jsx   | 11 +++++++++++
 superset-frontend/src/components/AlteredSliceTag/index.jsx    |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.test.jsx b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.test.jsx
index 6f5890018c..7501ce6382 100644
--- a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.test.jsx
+++ b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.test.jsx
@@ -69,6 +69,17 @@ describe('AlteredSliceTag', () => {
     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', () => {
     const testRows = ['testValue'];
     const getRowsFromDiffsStub = jest
diff --git a/superset-frontend/src/components/AlteredSliceTag/index.jsx b/superset-frontend/src/components/AlteredSliceTag/index.jsx
index 3e2d21ab13..e4a0d1bdeb 100644
--- a/superset-frontend/src/components/AlteredSliceTag/index.jsx
+++ b/superset-frontend/src/components/AlteredSliceTag/index.jsx
@@ -20,6 +20,7 @@ import React from 'react';
 import PropTypes from 'prop-types';
 import { isEqual, isEmpty } from 'lodash';
 import { t } from '@superset-ui/core';
+import { sanitizeFormData } from 'src/explore/exploreUtils/formData';
 import getControlsForVizType from 'src/utils/getControlsForVizType';
 import { safeStringify } from 'src/utils/safeStringify';
 import { Tooltip } from 'src/components/Tooltip';
@@ -82,8 +83,8 @@ export default class AlteredSliceTag extends React.Component {
   getDiffs(props) {
     // Returns all properties that differ in the
     // current form data and the saved form data
-    const ofd = props.origFormData;
-    const cfd = props.currentFormData;
+    const ofd = sanitizeFormData(props.origFormData);
+    const cfd = sanitizeFormData(props.currentFormData);
 
     const fdKeys = Object.keys(cfd);
     const diffs = {};