You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by dp...@apache.org on 2026/08/10 18:58:51 UTC

(superset) branch master updated: fix(deckgl): remove visibility condition in deckgl fill color (#42712)

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

DamianPendrak 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 651c046e699 fix(deckgl): remove visibility condition in deckgl fill color (#42712)
651c046e699 is described below

commit 651c046e6998126463eb521a81c002e5e11fb253
Author: Mallikarjuna Reddy Nimmakayala <ma...@gmail.com>
AuthorDate: Tue Aug 11 00:28:44 2026 +0530

    fix(deckgl): remove visibility condition in deckgl fill color (#42712)
    
    Co-authored-by: Damian Pendrak <dp...@gmail.com>
---
 .../src/utilities/Shared_DeckGL.test.ts            | 55 +++++++++++++++++++++-
 .../src/utilities/Shared_DeckGL.tsx                |  1 +
 2 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/utilities/Shared_DeckGL.test.ts b/superset-frontend/plugins/preset-chart-deckgl/src/utilities/Shared_DeckGL.test.ts
index fa8a56672a5..73f1010c353 100644
--- a/superset-frontend/plugins/preset-chart-deckgl/src/utilities/Shared_DeckGL.test.ts
+++ b/superset-frontend/plugins/preset-chart-deckgl/src/utilities/Shared_DeckGL.test.ts
@@ -17,9 +17,13 @@
  * under the License.
  */
 
-import { ControlPanelState } from '@superset-ui/chart-controls';
+import {
+  ControlPanelState,
+  ControlStateMapping,
+} from '@superset-ui/chart-controls';
 import { OSM_TILE_STYLE_URL } from '@superset-ui/core/utils/mapStyles';
-import { mapProvider, maplibreStyle } from './Shared_DeckGL';
+import { fillColorPicker, mapProvider, maplibreStyle } from './Shared_DeckGL';
+import { COLOR_SCHEME_TYPES } from './utils';
 
 const setBootstrap = ({
   conf = {},
@@ -159,3 +163,50 @@ test('deck.gl map style accepts well-formed tile overrides', () => {
   ]);
   expect(props.default).toBe('https://tiles.example.com/style.json');
 });
+
+// fillColorPicker visibility tests
+type FillColorPickerConfig = typeof fillColorPicker.config & {
+  visibility: (ctx: { controls: ControlStateMapping }) => boolean;
+};
+
+const fillColorPickerVisibility = (controls: ControlStateMapping) =>
+  (fillColorPicker.config as FillColorPickerConfig).visibility({ controls });
+
+const makeControls = (schemeType?: string): ControlStateMapping =>
+  schemeType === undefined
+    ? ({} as ControlStateMapping)
+    : ({
+        color_scheme_type: { value: schemeType },
+      } as unknown as ControlStateMapping);
+
+test('fillColorPicker is visible when color_scheme_type is absent (legacy form)', () => {
+  expect(fillColorPickerVisibility(makeControls(undefined))).toBe(true);
+});
+
+test('fillColorPicker is visible when color_scheme_type is fixed_color', () => {
+  expect(
+    fillColorPickerVisibility(makeControls(COLOR_SCHEME_TYPES.fixed_color)),
+  ).toBe(true);
+});
+
+test('fillColorPicker is hidden when color_scheme_type is categorical_palette', () => {
+  expect(
+    fillColorPickerVisibility(
+      makeControls(COLOR_SCHEME_TYPES.categorical_palette),
+    ),
+  ).toBe(false);
+});
+
+test('fillColorPicker is hidden when color_scheme_type is color_breakpoints', () => {
+  expect(
+    fillColorPickerVisibility(
+      makeControls(COLOR_SCHEME_TYPES.color_breakpoints),
+    ),
+  ).toBe(false);
+});
+
+test('fillColorPicker is hidden when color_scheme_type is linear_palette', () => {
+  expect(
+    fillColorPickerVisibility(makeControls(COLOR_SCHEME_TYPES.linear_palette)),
+  ).toBe(false);
+});
diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx b/superset-frontend/plugins/preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx
index c9d4a73f8a7..5fc79c760ec 100644
--- a/superset-frontend/plugins/preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx
+++ b/superset-frontend/plugins/preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx
@@ -287,6 +287,7 @@ export const fillColorPicker: CustomControlItem = {
     default: PRIMARY_COLOR,
     renderTrigger: true,
     visibility: ({ controls }) =>
+      !controls.color_scheme_type ||
       isColorSchemeTypeVisible(controls, COLOR_SCHEME_TYPES.fixed_color),
   },
 };