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

michaelsmolina pushed a commit to branch 4.1-airbnb
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/4.1-airbnb by this push:
     new 1dcccc0da8 fix: x axis title disappears when editing bar chart (#30821)
1dcccc0da8 is described below

commit 1dcccc0da81d05b77c376992e644ed524d118199
Author: Damian Pendrak <[email protected]>
AuthorDate: Fri Nov 29 16:09:03 2024 +0100

    fix: x axis title disappears when editing bar chart (#30821)
    
    (cherry picked from commit 97dde8c4855641de38f01218d0a4bb5460e3f1b2)
---
 .../superset-ui-chart-controls/src/types.ts        |  1 +
 .../src/Timeseries/Regular/Bar/controlPanel.tsx    | 24 ++++++++++++++++++++++
 .../explore/components/ControlPanelsContainer.tsx  |  4 ++--
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/types.ts 
b/superset-frontend/packages/superset-ui-chart-controls/src/types.ts
index 86e7b1c04e..5a04ff71d0 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/types.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/types.ts
@@ -259,6 +259,7 @@ export interface BaseControlConfig<
     props: ControlPanelsContainerProps,
     controlData: AnyDict,
   ) => boolean;
+  disableStash?: boolean;
   hidden?:
     | boolean
     | ((props: ControlPanelsContainerProps, controlData: AnyDict) => boolean);
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
index 7482c7a16b..568cf07a84 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
@@ -73,6 +73,8 @@ function createAxisTitleControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: t('Changing this control takes effect instantly'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isVertical(controls) : isHorizontal(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -90,6 +92,8 @@ function createAxisTitleControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: t('Changing this control takes effect instantly'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isVertical(controls) : isHorizontal(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -104,6 +108,8 @@ function createAxisTitleControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: t('Changing this control takes effect instantly'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isHorizontal(controls) : isVertical(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -121,6 +127,8 @@ function createAxisTitleControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: t('Changing this control takes effect instantly'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isHorizontal(controls) : isVertical(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -138,6 +146,8 @@ function createAxisTitleControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: t('Changing this control takes effect instantly'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isHorizontal(controls) : isVertical(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -160,6 +170,8 @@ function createAxisControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: `${D3_TIME_FORMAT_DOCS}. 
${TIME_SERIES_DESCRIPTION_TEXT}`,
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isVertical(controls) : isHorizontal(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -170,6 +182,8 @@ function createAxisControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           ...xAxisLabelRotation.config,
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isVertical(controls) : isHorizontal(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -181,6 +195,8 @@ function createAxisControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           label: t('Axis Format'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isHorizontal(controls) : isVertical(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -196,6 +212,8 @@ function createAxisControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: t('Logarithmic axis'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isHorizontal(controls) : isVertical(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -210,6 +228,8 @@ function createAxisControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: t('Draw split lines for minor axis ticks'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isHorizontal(controls) : isVertical(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -226,6 +246,8 @@ function createAxisControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           description: t('It’s not recommended to truncate axis in Bar 
chart.'),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isHorizontal(controls) : isVertical(controls),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
@@ -246,6 +268,8 @@ function createAxisControl(axis: 'x' | 'y'): 
ControlSetRow[] {
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             Boolean(controls?.truncateYAxis?.value) &&
             (isXAxis ? isHorizontal(controls) : isVertical(controls)),
+          disableStash: true,
+          resetOnHide: false,
         },
       },
     ],
diff --git 
a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx 
b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
index 27bf09d79d..4a3bae20ea 100644
--- a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
+++ b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
@@ -448,7 +448,7 @@ export const ControlPanelsContainer = (props: 
ControlPanelsContainerProps) => {
 
   const renderControl = ({ name, config }: CustomControlItem) => {
     const { controls, chart, exploreState } = props;
-    const { visibility, hidden, ...restConfig } = config;
+    const { visibility, hidden, disableStash, ...restConfig } = config;
 
     // If the control item is not an object, we have to look up the control 
data from
     // the centralized controls file.
@@ -529,7 +529,7 @@ export const ControlPanelsContainer = (props: 
ControlPanelsContainerProps) => {
 
     return (
       <StashFormDataContainer
-        shouldStash={isVisible === false}
+        shouldStash={isVisible === false && disableStash !== true}
         fieldNames={[name]}
         key={`control-container-${name}`}
       >

Reply via email to