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

(superset) 01/15: fix(AlteredSliceTag): not display undefined filter value for chart change record (#38883)

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

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

commit 6cff944b7f9e55b242b3209a20b25ed4b8f22f30
Author: Đỗ Trọng Hải <41...@users.noreply.github.com>
AuthorDate: Tue Mar 31 20:38:22 2026 +0700

    fix(AlteredSliceTag): not display undefined filter value for chart change record (#38883)
    
    Signed-off-by: hainenber <do...@gmail.com>
    (cherry picked from commit 11f2140c37e23f6022f937a6e08267b21a28ac1d)
---
 .../src/components/AlteredSliceTag/utils/index.ts  |  2 +-
 .../components/AlteredSliceTag/utils/utils.test.ts | 27 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/superset-frontend/src/components/AlteredSliceTag/utils/index.ts b/superset-frontend/src/components/AlteredSliceTag/utils/index.ts
index 482a4332621..9fa9830e785 100644
--- a/superset-frontend/src/components/AlteredSliceTag/utils/index.ts
+++ b/superset-frontend/src/components/AlteredSliceTag/utils/index.ts
@@ -52,7 +52,7 @@ export const formatValueHandler = (
           v.comparator && v.comparator.constructor === Array
             ? `[${v.comparator.join(', ')}]`
             : v.comparator;
-        return `${v.subject} ${v.operator} ${filterVal}`;
+        return filterVal ? `${v.subject} ${v.operator} ${filterVal}` : `${v.subject} ${v.operator}`;
       })
       .join(', ');
   }
diff --git a/superset-frontend/src/components/AlteredSliceTag/utils/utils.test.ts b/superset-frontend/src/components/AlteredSliceTag/utils/utils.test.ts
index feddddeb0a1..1ceee92c589 100644
--- a/superset-frontend/src/components/AlteredSliceTag/utils/utils.test.ts
+++ b/superset-frontend/src/components/AlteredSliceTag/utils/utils.test.ts
@@ -258,6 +258,33 @@ describe('formatValueHandler', () => {
 
     expect(result).toEqual(expected);
   });
+
+  test('formats unary filter', () => {
+    const filters = [
+      {
+        expressionType: 'SIMPLE',
+        operator: 'IS NULL',
+        subject: 'a',
+      },
+      {
+        clause: 'WHERE',
+        comparator: ['hu', 'ho', 'ha'],
+        expressionType: 'SIMPLE',
+        operator: 'NOT IN',
+        subject: 'b',
+      },
+    ];
+    const key = 'adhoc_filters';
+
+    const expected = 'a IS NULL, b NOT IN [hu, ho, ha]';
+    const formattedValue: string | number = formatValueHandler(
+      filters,
+      key,
+      controlsMap,
+    );
+
+    expect(formattedValue).toEqual(expected);
+  });
 });
 
 // eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks