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 2023/03/28 11:09:01 UTC

[superset] branch master updated: fix(generic-x-axis): skip initial time filter for legacy charts (#23506)

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 8db5cb18c0 fix(generic-x-axis): skip initial time filter for legacy charts (#23506)
8db5cb18c0 is described below

commit 8db5cb18c01ee8c9ee1fb3dc60c3af32682c47f7
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Tue Mar 28 14:08:52 2023 +0300

    fix(generic-x-axis): skip initial time filter for legacy charts (#23506)
---
 .../superset-ui-chart-controls/src/shared-controls/mixins.tsx         | 4 +++-
 superset-frontend/src/explore/components/ControlPanelsContainer.tsx   | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/mixins.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/mixins.tsx
index 0b19b96c7f..1db389ddec 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/mixins.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/mixins.tsx
@@ -73,9 +73,11 @@ export const datePickerInAdhocFilterMixin: Pick<
   initialValue: (control: ControlState, state: ControlPanelState | null) => {
     // skip initialValue if
     // 1) GENERIC_CHART_AXES is disabled
-    // 2) there was a time filter in adhoc filters
+    // 2) the time_range control is present (this is the case for legacy charts)
+    // 3) there was a time filter in adhoc filters
     if (
       !hasGenericChartAxes ||
+      state?.controls?.time_range?.value ||
       ensureIsArray(control.value).findIndex(
         (flt: any) => flt?.operator === 'TEMPORAL_RANGE',
       ) > -1
diff --git a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
index 7d0ceea50c..142b81d690 100644
--- a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
+++ b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
@@ -495,7 +495,7 @@ export const ControlPanelsContainer = (props: ControlPanelsContainerProps) => {
       ) => {
         const isTemporalRange = (filter: Record<string, any>) =>
           filter.operator === Operators.TEMPORAL_RANGE;
-        if (isTemporalRange(valueToBeDeleted)) {
+        if (!controls?.time_range?.value && isTemporalRange(valueToBeDeleted)) {
           const count = values.filter(isTemporalRange).length;
           if (count === 1) {
             return t(