You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "LuisSanchez (via GitHub)" <gi...@apache.org> on 2026/01/20 03:10:38 UTC

[PR] fix(FiltersBadge): Enhance filter status calculation and add tests for native filters with no values [superset]

LuisSanchez opened a new pull request, #37260:
URL: https://github.com/apache/superset/pull/37260

   ### SUMMARY
   
   [Dashboard] - World map won't show filter info icon when default filters are applied
   
   Indicators were only calculated when `chart.chartStatus` was 'rendered' or 'success', and the `getStatus` function required columns to be in `appliedColumns` (from query response).
   
   ### Solution
   Indicators can be calculated when `dataMask` has values for filters targeting the chart, regardless of chart status. The `getStatus` function treats a filter as applied if it has a value and isn't rejected, even if the chart hasn't loaded yet
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   To be added
   
   ### TESTING INSTRUCTIONS
   
   1. Navigate to FCC New Coder Survey 2018 dashboard
   2. Click to edit filters
   3. Select a filter to edit
   4. Add a default value
   5. Save
   6. Notice that the filter will apply to all charts of its scope correctly, including the World map (Country of citizenship), but the filter icon will be missing for this one
   7. Even if you refresh, this won't be fixed unless you add more filters, different than the default one.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue: 97104
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "LuisSanchez (via GitHub)" <gi...@apache.org>.
LuisSanchez commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2736713617


##########
superset-frontend/src/dashboard/components/nativeFilters/selectors.ts:
##########
@@ -281,8 +285,19 @@ const getStatus = ({
   }
   if (column && rejectedColumns?.has(column))
     return IndicatorStatus.Incompatible;
-  if (column && appliedColumns?.has(column) && hasValue) {
-    return APPLIED_STATUS;
+  // If filter has a value and column is not rejected, show as applied
+  // This works even when chart hasn't loaded yet (appliedColumns is empty)
+  // The dataMask state is the source of truth for filter application
+  if (column && hasValue && !rejectedColumns?.has(column)) {

Review Comment:
   Due to the latests changes, this won't be needed, thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3884260808

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3842845285

   ⚠️ **DEPRECATED WORKFLOW** ⚠️
   
   @sadpandajoe This workflow is deprecated! Please use the new **Superset Showtime** system instead:
   
   - Replace "testenv-up" label with "🎪 trigger-start"
   - Better reliability and easier management
   - See https://github.com/mistercrunch/superset-showtime for details
   
   Processing your ephemeral environment request [here](https://github.com/apache/superset/actions/runs/21641887968). Action: **up**. More information on [how to use or configure ephemeral environments](https://superset.apache.org/docs/contributing/howtos/#github-ephemeral-environments)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3842889830

   @sadpandajoe Ephemeral environment spinning up at http://16.148.136.240:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz merged PR #37260:
URL: https://github.com/apache/superset/pull/37260


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "LuisSanchez (via GitHub)" <gi...@apache.org>.
LuisSanchez commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2736714455


##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx:
##########
@@ -416,11 +416,18 @@ const FilterBar: FC<FiltersBarProps> = ({
   const handleClearAll = useCallback(() => {
     const newClearAllTriggers = { ...clearAllTriggers };
     nativeFilterValues.forEach(filter => {
-      const { id } = filter;
+      const { id, filterType } = filter;
+      // Range filters use [null, null] as the cleared value; others use null
+      const clearedValue = filterType === 'filter_range' ? [null, null] : null;
+      const clearedDataMask = {
+        filterState: { value: clearedValue },
+        extraFormData: {},
+      };
       if (dataMaskSelected[id]) {
+        dispatch(updateDataMask(id, clearedDataMask));
         setDataMaskSelected(draft => {
           if (draft[id].filterState?.value !== undefined) {
-            draft[id].filterState!.value = undefined;
+            draft[id].filterState!.value = clearedValue;

Review Comment:
   Indeed, this will be hard to test. I think that, in order to maintain backwards compatibility, we can assign `undefined` if not `filter_range`, for example:
   ``` javascript
   const clearedValue = filterType === 'filter_range' ? [null, null] : undefined;
   ```
   This should not break the code and keeps the current functionality of the `filter_range`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3795782163

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3882935919

   <img src="https://media4.giphy.com/media/v1.Y2lkPWJkM2VhNTdleHFoazRkaW13enZ4ajdkbzRndzl0bDNtdnQ0Ynh5eTloMWJzdDZ0diZlcD12MV9naWZzX3NlYXJjaCZjdD1n/cFkiFMDg3iFoI/giphy.gif"/>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2793381551


##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx:
##########
@@ -416,11 +416,19 @@ const FilterBar: FC<FiltersBarProps> = ({
   const handleClearAll = useCallback(() => {
     const newClearAllTriggers = { ...clearAllTriggers };
     nativeFilterValues.forEach(filter => {
-      const { id } = filter;
+      const { id, filterType } = filter;
+      // Range filters use [null, null] as the cleared value; others use undefined
+      const clearedValue =
+        filterType === 'filter_range' ? [null, null] : undefined;
+      const clearedDataMask = {
+        filterState: { value: clearedValue },
+        extraFormData: {},
+      };
       if (dataMaskSelected[id]) {
+        dispatch(updateDataMask(id, clearedDataMask));
         setDataMaskSelected(draft => {
           if (draft[id].filterState?.value !== undefined) {
-            draft[id].filterState!.value = undefined;
+            draft[id].filterState!.value = clearedValue;
           }
           draft[id].extraFormData = {};
         });

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Logic Bug in Filter Clearing</b></div>
   <div id="fix">
   
   The conditional check prevents setting the cleared value when the current filter state value is undefined, which can leave range filters in an incorrect undefined state instead of [null, null]. This creates inconsistency between the dispatched data mask and the local state.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
           setDataMaskSelected(draft => {
             draft[id].filterState!.value = clearedValue;
             draft[id].extraFormData = {};
           });
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a16557</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3795673593

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "michaelmorera92 (via GitHub)" <gi...@apache.org>.
michaelmorera92 commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3851146590

   I worked on the testing of this ticket, the application is working as expected. The filters are correctly displayed on the filters of the dashboard.
   
   # Tested scenarios
   The tooltip filter is correctly displayed in the chart cart at the dashboards.
   | Variant | Status |
   | -------- | -------- |
   | Existing dashboards | :white_check_mark:  |
   | New dashboards | :white_check_mark:  |
   | Refreshing the page | :white_check_mark:  |
   | Using many filters | :white_check_mark:  |
   | Using a single filter | :white_check_mark:  |
   
   ## Steps
   1. Navigate to FCC New Coder Survey 2018 dashboard
   2. Click to edit filters
   3. Select a filter to edit
   4. Add a default value
   5. Save
   
   ### Current result
   After the step 5 (for all the variant scenarios), the application displays correctly the filter tooltip with the correct values.
   
   ## Evidence
   **Tooltip displayed**
   <img width="970" height="702" alt="image" src="https://github.com/user-attachments/assets/5a6eb587-08e7-422c-bd38-b8de13af6fbf" />
   
   ![worldmaptooltipfilterscorrectlydisplayed](https://github.com/user-attachments/assets/f8776cc9-3f56-4e93-9ac2-382f49e8d62f)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "LuisSanchez (via GitHub)" <gi...@apache.org>.
LuisSanchez commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2783785018


##########
superset/common/query_context_processor.py:
##########
@@ -98,6 +98,18 @@ def get_df_payload(
             force_cached=force_cached,
         )
 
+        # If cache is loaded but missing applied_filter_columns and query has filters,
+        # treat as cache miss to ensure fresh query with proper applied_filter_columns
+        if (
+            query_obj
+            and cache_key
+            and cache.is_loaded
+            and not cache.applied_filter_columns
+            and query_obj.filter
+            and len(query_obj.filter) > 0
+        ):
+            cache.is_loaded = False
+

Review Comment:
   Indeed it solves the problem of not having the `applied_filter_columns`, maybe I was being too careful, but didn't want to bypass any condition, only with `not cache.applied_filter_columns` should work.
   
   Related to:
   > Can we make sure applied_filter_columns are never missing when they should exist?
   
   Yes, I made sure that if `appliedColumns` does not exist on the frontend, created a callback to the backend with the new `getAppliedColumnsWithFallback` function.
   
   The other 2 minor fixes on this PR are related to how the `clear all` was reseting the values, specially with range number (which happened on my test case) and the `ensureIsArray`, I talked about this bug on the other thread, for some cases it was returning `", "`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2737379164


##########
superset-frontend/src/dashboard/components/nativeFilters/selectors.test.ts:
##########
@@ -142,3 +147,421 @@ describe('getCrossFilterIndicator', () => {
     });
   });
 });
+
+test('extractLabel returns label when filter has label and it does not include undefined', () => {
+  expect(extractLabel({ label: 'My Label', value: 'x' })).toBe('My Label');
+  expect(extractLabel({ label: 'Only label' })).toBe('Only label');
+});
+
+test('extractLabel returns value joined by ", " when filter has non-empty array value and no label', () => {
+  expect(extractLabel({ value: ['a', 'b'] })).toBe('a, b');
+  expect(extractLabel({ value: ['single'] })).toBe('single');
+});
+
+test('extractLabel returns value when filter has non-array value (ensureIsArray wraps it)', () => {
+  expect(extractLabel({ value: 'scalar' })).toBe('scalar');
+  expect(extractLabel({ value: 42 })).toBe('42');
+});
+
+test('extractLabel returns null when filter is undefined or has no label and no value', () => {
+  expect(extractLabel(undefined)).toBe(null);
+  expect(extractLabel({})).toBe(null);
+  expect(extractLabel({ label: '' })).toBe(null);
+});
+
+test('extractLabel returns null when filter.value is null or undefined', () => {
+  expect(extractLabel({ value: null })).toBe(null);
+  expect(extractLabel({ value: undefined })).toBe(null);
+});
+
+test('extractLabel does not return ", " or "null, null" for arrays of only null, undefined, or empty string', () => {
+  expect(extractLabel({ value: [null, null] })).toBe(null);
+  expect(extractLabel({ value: [null] })).toBe(null);
+  expect(extractLabel({ value: [''] })).toBe(null);
+  expect(extractLabel({ value: ['', ''] })).toBe(null);
+  expect(extractLabel({ value: [null, ''] })).toBe(null);
+  expect(extractLabel({ value: [undefined, undefined] })).toBe(null);
+  expect(extractLabel({ value: [null, undefined, ''] })).toBe(null);
+  expect(extractLabel({ value: [null, null] })).not.toBe(', ');
+  expect(extractLabel({ value: [null, ''] })).not.toBe(', ');
+});
+
+test('extractLabel returns only non-empty items when array has mix of empty and non-empty', () => {
+  expect(extractLabel({ value: [null, 'a', '', 'b', undefined] })).toBe('a, b');
+  expect(extractLabel({ value: ['', 'x', ''] })).toBe('x');
+});
+
+test('extractLabel uses value when label is undefined', () => {
+  expect(extractLabel({ label: undefined, value: ['a'] })).toBe('a');
+});
+
+test('getAppliedColumnsWithFallback returns columns from query response when available', () => {
+  const chart = {
+    queriesResponse: [
+      {
+        applied_filters: [{ column: 'age' }, { column: 'name' }],
+      },
+    ],
+  };
+  const result = getAppliedColumnsWithFallback(chart);
+  expect(result).toEqual(new Set(['age', 'name']));
+});
+
+test('getAppliedColumnsWithFallback returns empty set when query response has no applied_filters and no fallback params', () => {
+  const chart = {
+    queriesResponse: [{ applied_filters: [] }],
+  };
+  const result = getAppliedColumnsWithFallback(chart);
+  expect(result).toEqual(new Set());
+});
+
+test('getAppliedColumnsWithFallback derives columns from native filters when query response is empty', () => {
+  const chart = {
+    queriesResponse: [{ applied_filters: [] }],
+  };
+  const nativeFilters = {
+    filter1: {
+      id: 'filter1',
+      type: NativeFilterType.NativeFilter,
+      chartsInScope: [123],
+      targets: [{ column: { name: 'age' } }],
+    },
+    filter2: {
+      id: 'filter2',
+      type: NativeFilterType.NativeFilter,
+      chartsInScope: [123],
+      targets: [{ column: { name: 'name' } }],
+    },
+  } as any;
+  const dataMask = {
+    filter1: {
+      id: 'filter1',
+      filterState: { value: '25' },
+      extraFormData: {},
+    },
+    filter2: {
+      id: 'filter2',
+      filterState: { value: 'John' },
+      extraFormData: {},
+    },
+  } as any;
+  const result = getAppliedColumnsWithFallback(
+    chart,
+    nativeFilters,
+    dataMask,
+    123,
+  );
+  expect(result).toEqual(new Set(['age', 'name']));
+});

Review Comment:
   <!-- Bito Reply -->
   Understood. Removing tests for `getStatus` since the function isn't modified helps keep the PR focused and avoids unnecessary LOC.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "LuisSanchez (via GitHub)" <gi...@apache.org>.
LuisSanchez commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2736732377


##########
superset-frontend/src/dashboard/components/nativeFilters/selectors.ts:
##########
@@ -281,8 +285,19 @@ const getStatus = ({
   }
   if (column && rejectedColumns?.has(column))
     return IndicatorStatus.Incompatible;
-  if (column && appliedColumns?.has(column) && hasValue) {
-    return APPLIED_STATUS;
+  // If filter has a value and column is not rejected, show as applied
+  // This works even when chart hasn't loaded yet (appliedColumns is empty)
+  // The dataMask state is the source of truth for filter application
+  if (column && hasValue && !rejectedColumns?.has(column)) {
+    // If chart has loaded and confirmed this column was applied, use that
+    if (appliedColumns?.has(column)) {
+      return APPLIED_STATUS;
+    }
+    // If chart hasn't loaded yet but we have a value, assume it's applied
+    // This allows showing filter indicators before query response is available
+    if (!appliedColumns || appliedColumns.size === 0) {

Review Comment:
   I was trying to add a refresh‑state icon to help out with this, and after refreshing the page I found that the `world_map` chart did not have `appliedColumns` set (the debug code at the end shows how I discovered this).
   
   So I took a different approach by setting the applied columns with a fallback instead.
   Please check `getAppliedColumnsWithFallback` on [superset-frontend/src/dashboard/components/nativeFilters/selectors.ts](https://github.com/apache/superset/pull/37260/files/bb10ceec045a6f33186c15bc026fb5fc3c746c4e#diff-b99fa1c34f77b95ef03afdaa8b9c7f6ef2a6841f8bfeedc65c6d691c2bff5e5c)
   
   ### Debug code:
   When refreshing the page: `appliedColumns` is empty, but `column` and `hasValue`, are not. This conditional is made to work mainly when the user refreshes the page.
   
   ``` javascript
   if (column && hasValue) {
     if (chart.form_data.viz_type === 'world_map') {
       console.log('----1ST CONDITION----', APPLIED_STATUS);
       console.log('CHART_TYPE', chart.form_data.viz_type);
       console.log('APPLIED_COLUMNS', appliedColumns);
       console.log('COLUMN', column);
       console.log('HAS VALUE', hasValue);
     }
     // If chart has loaded and confirmed this column was applied, use that
     if (appliedColumns?.has(column)) {
       if (chart.form_data.viz_type === 'world_map')
         console.log('----2ND CONDITION----', APPLIED_STATUS);
       return APPLIED_STATUS;
     }
     // If chart hasn't loaded yet but we have a value, assume it's applied
     // This allows showing filter indicators before query response is available
     if (!appliedColumns || appliedColumns.size === 0) {
       if (chart.form_data.viz_type === 'world_map')
         console.log('----3RD CONDITION----', APPLIED_STATUS);
       return APPLIED_STATUS;
     }
   }
   ```
   
   ### Browser logs immediately when applying filters.
   It works because it enters on 2nd conditional and `appliedColumns` is not empty because filters were just applied.
   
   <img width="542" height="408" alt="image" src="https://github.com/user-attachments/assets/a6b8ada2-d1a9-4704-af01-9e39e4eb4ce0" />
   
   ### If the page is refreshed (current bug):
   `appliedColumns` are now empty after the refresh.
   
   <img width="545" height="545" alt="image" src="https://github.com/user-attachments/assets/0b03489c-6d3f-4187-9a50-9b8ec8c5a7c7" />



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2737074863


##########
superset-frontend/src/dashboard/components/nativeFilters/selectors.test.ts:
##########
@@ -142,3 +147,421 @@ describe('getCrossFilterIndicator', () => {
     });
   });
 });
+
+test('extractLabel returns label when filter has label and it does not include undefined', () => {
+  expect(extractLabel({ label: 'My Label', value: 'x' })).toBe('My Label');
+  expect(extractLabel({ label: 'Only label' })).toBe('Only label');
+});
+
+test('extractLabel returns value joined by ", " when filter has non-empty array value and no label', () => {
+  expect(extractLabel({ value: ['a', 'b'] })).toBe('a, b');
+  expect(extractLabel({ value: ['single'] })).toBe('single');
+});
+
+test('extractLabel returns value when filter has non-array value (ensureIsArray wraps it)', () => {
+  expect(extractLabel({ value: 'scalar' })).toBe('scalar');
+  expect(extractLabel({ value: 42 })).toBe('42');
+});
+
+test('extractLabel returns null when filter is undefined or has no label and no value', () => {
+  expect(extractLabel(undefined)).toBe(null);
+  expect(extractLabel({})).toBe(null);
+  expect(extractLabel({ label: '' })).toBe(null);
+});
+
+test('extractLabel returns null when filter.value is null or undefined', () => {
+  expect(extractLabel({ value: null })).toBe(null);
+  expect(extractLabel({ value: undefined })).toBe(null);
+});
+
+test('extractLabel does not return ", " or "null, null" for arrays of only null, undefined, or empty string', () => {
+  expect(extractLabel({ value: [null, null] })).toBe(null);
+  expect(extractLabel({ value: [null] })).toBe(null);
+  expect(extractLabel({ value: [''] })).toBe(null);
+  expect(extractLabel({ value: ['', ''] })).toBe(null);
+  expect(extractLabel({ value: [null, ''] })).toBe(null);
+  expect(extractLabel({ value: [undefined, undefined] })).toBe(null);
+  expect(extractLabel({ value: [null, undefined, ''] })).toBe(null);
+  expect(extractLabel({ value: [null, null] })).not.toBe(', ');
+  expect(extractLabel({ value: [null, ''] })).not.toBe(', ');
+});
+
+test('extractLabel returns only non-empty items when array has mix of empty and non-empty', () => {
+  expect(extractLabel({ value: [null, 'a', '', 'b', undefined] })).toBe('a, b');
+  expect(extractLabel({ value: ['', 'x', ''] })).toBe('x');
+});
+
+test('extractLabel uses value when label is undefined', () => {
+  expect(extractLabel({ label: undefined, value: ['a'] })).toBe('a');
+});
+
+test('getAppliedColumnsWithFallback returns columns from query response when available', () => {
+  const chart = {
+    queriesResponse: [
+      {
+        applied_filters: [{ column: 'age' }, { column: 'name' }],
+      },
+    ],
+  };
+  const result = getAppliedColumnsWithFallback(chart);
+  expect(result).toEqual(new Set(['age', 'name']));
+});
+
+test('getAppliedColumnsWithFallback returns empty set when query response has no applied_filters and no fallback params', () => {
+  const chart = {
+    queriesResponse: [{ applied_filters: [] }],
+  };
+  const result = getAppliedColumnsWithFallback(chart);
+  expect(result).toEqual(new Set());
+});
+
+test('getAppliedColumnsWithFallback derives columns from native filters when query response is empty', () => {
+  const chart = {
+    queriesResponse: [{ applied_filters: [] }],
+  };
+  const nativeFilters = {
+    filter1: {
+      id: 'filter1',
+      type: NativeFilterType.NativeFilter,
+      chartsInScope: [123],
+      targets: [{ column: { name: 'age' } }],
+    },
+    filter2: {
+      id: 'filter2',
+      type: NativeFilterType.NativeFilter,
+      chartsInScope: [123],
+      targets: [{ column: { name: 'name' } }],
+    },
+  } as any;
+  const dataMask = {
+    filter1: {
+      id: 'filter1',
+      filterState: { value: '25' },
+      extraFormData: {},
+    },
+    filter2: {
+      id: 'filter2',
+      filterState: { value: 'John' },
+      extraFormData: {},
+    },
+  } as any;
+  const result = getAppliedColumnsWithFallback(
+    chart,
+    nativeFilters,
+    dataMask,
+    123,
+  );
+  expect(result).toEqual(new Set(['age', 'name']));
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Removed tests for used function</b></div>
   <div id="fix">
   
   The diff removes tests for the getStatus function, but code_symbol_search confirms it is still defined and used in selectors.ts (e.g., at lines 362 and 436). Removing tests for a used function reduces test coverage and risks regressions.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #9c9736</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): Enhance filter status calculation and add tests for native filters with no values [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3770823972

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3811730403

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "gabotorresruiz (via GitHub)" <gi...@apache.org>.
gabotorresruiz commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2742854078


##########
superset-frontend/src/dashboard/components/nativeFilters/selectors.ts:
##########
@@ -281,8 +285,19 @@ const getStatus = ({
   }
   if (column && rejectedColumns?.has(column))
     return IndicatorStatus.Incompatible;
-  if (column && appliedColumns?.has(column) && hasValue) {
-    return APPLIED_STATUS;
+  // If filter has a value and column is not rejected, show as applied
+  // This works even when chart hasn't loaded yet (appliedColumns is empty)
+  // The dataMask state is the source of truth for filter application
+  if (column && hasValue && !rejectedColumns?.has(column)) {
+    // If chart has loaded and confirmed this column was applied, use that
+    if (appliedColumns?.has(column)) {
+      return APPLIED_STATUS;
+    }
+    // If chart hasn't loaded yet but we have a value, assume it's applied
+    // This allows showing filter indicators before query response is available
+    if (!appliedColumns || appliedColumns.size === 0) {

Review Comment:
   Thanks for the detailed explanation and the debug logs! I think this make sense, this looks solid! Thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3884000075

   Good thing we did a rebase! There are some ci issue that needs fixing now @LuisSanchez 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "LuisSanchez (via GitHub)" <gi...@apache.org>.
LuisSanchez commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3883942094

   Rebased @msyavuz 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2768050181


##########
superset/common/query_context_processor.py:
##########
@@ -98,6 +98,18 @@ def get_df_payload(
             force_cached=force_cached,
         )
 
+        # If cache is loaded but missing applied_filter_columns and query has filters,
+        # treat as cache miss to ensure fresh query with proper applied_filter_columns
+        if (
+            query_obj
+            and cache_key
+            and cache.is_loaded
+            and not cache.applied_filter_columns
+            and query_obj.filter
+            and len(query_obj.filter) > 0
+        ):
+            cache.is_loaded = False
+

Review Comment:
   Isn't this enough to fix the issue by itself? Even then this feels like a bandaid. Can we make sure applied_filter_columns are never missing when they should exist? Am i understanding correctly?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "gabotorresruiz (via GitHub)" <gi...@apache.org>.
gabotorresruiz commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2728925809


##########
superset-frontend/src/dashboard/components/nativeFilters/selectors.ts:
##########
@@ -281,8 +285,19 @@ const getStatus = ({
   }
   if (column && rejectedColumns?.has(column))
     return IndicatorStatus.Incompatible;
-  if (column && appliedColumns?.has(column) && hasValue) {
-    return APPLIED_STATUS;
+  // If filter has a value and column is not rejected, show as applied
+  // This works even when chart hasn't loaded yet (appliedColumns is empty)
+  // The dataMask state is the source of truth for filter application
+  if (column && hasValue && !rejectedColumns?.has(column)) {

Review Comment:
   Nit: The `rejectedColumns?.has(column)` on line `286` already returns `Incompatible` for rejected columns, so if we reach line 291 the column is guaranteed not rejected.
   
   This could be simplified to:
   ```js
   if (column && hasValue) {
     ...
   }
   ```
   
   Not blocking, just a readability improvement.



##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx:
##########
@@ -416,11 +416,18 @@ const FilterBar: FC<FiltersBarProps> = ({
   const handleClearAll = useCallback(() => {
     const newClearAllTriggers = { ...clearAllTriggers };
     nativeFilterValues.forEach(filter => {
-      const { id } = filter;
+      const { id, filterType } = filter;
+      // Range filters use [null, null] as the cleared value; others use null
+      const clearedValue = filterType === 'filter_range' ? [null, null] : null;
+      const clearedDataMask = {
+        filterState: { value: clearedValue },
+        extraFormData: {},
+      };
       if (dataMaskSelected[id]) {
+        dispatch(updateDataMask(id, clearedDataMask));
         setDataMaskSelected(draft => {
           if (draft[id].filterState?.value !== undefined) {
-            draft[id].filterState!.value = undefined;
+            draft[id].filterState!.value = clearedValue;

Review Comment:
   This assignment can no longer be `undefined` (as it could be previously), since `clearedValue` is now always defined as:
   ```js
   const clearedValue = filterType === 'filter_range' ? [null, null] : null;
   ```
   
   Are we certain this change does not impact any existing checks or behavior elsewhere in the codebase that rely on `undefined` specifically?



##########
superset-frontend/src/dashboard/components/nativeFilters/selectors.ts:
##########
@@ -281,8 +285,19 @@ const getStatus = ({
   }
   if (column && rejectedColumns?.has(column))
     return IndicatorStatus.Incompatible;
-  if (column && appliedColumns?.has(column) && hasValue) {
-    return APPLIED_STATUS;
+  // If filter has a value and column is not rejected, show as applied
+  // This works even when chart hasn't loaded yet (appliedColumns is empty)
+  // The dataMask state is the source of truth for filter application
+  if (column && hasValue && !rejectedColumns?.has(column)) {
+    // If chart has loaded and confirmed this column was applied, use that
+    if (appliedColumns?.has(column)) {
+      return APPLIED_STATUS;
+    }
+    // If chart hasn't loaded yet but we have a value, assume it's applied
+    // This allows showing filter indicators before query response is available
+    if (!appliedColumns || appliedColumns.size === 0) {

Review Comment:
   So if a chart hasn't loaded yet (`appliedColumns` is empty), the indicator will show as `"Applied"`?
   
   Would it make sense to add a loading/pending state instead of assuming `"Applied"`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3811421998

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/37260?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `2 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 43.66%. Comparing base ([`b09e60c`](https://app.codecov.io/gh/apache/superset/commit/b09e60c1ec261af5e59b5ad071ec7a4216c4675f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`e540ad5`](https://app.codecov.io/gh/apache/superset/commit/e540ad5224cf7314d4369d34b049ab573cc68a67?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 41 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/37260?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/common/query\_context\_processor.py](https://app.codecov.io/gh/apache/superset/pull/37260?src=pr&el=tree&filepath=superset%2Fcommon%2Fquery_context_processor.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHRfcHJvY2Vzc29yLnB5) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/37260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #37260       +/-   ##
   ===========================================
   + Coverage        0   43.66%   +43.66%     
   ===========================================
     Files           0      643      +643     
     Lines           0    49051    +49051     
     Branches        0     5501     +5501     
   ===========================================
   + Hits            0    21416    +21416     
   - Misses          0    27337    +27337     
   - Partials        0      298      +298     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/37260/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/37260/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.91% <0.00%> (?)` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/37260/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.93% <0.00%> (?)` | |
   | [python](https://app.codecov.io/gh/apache/superset/pull/37260/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `43.65% <0.00%> (?)` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/37260/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/37260?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): world map wont show filter icon after refresh page [superset]

Posted by "LuisSanchez (via GitHub)" <gi...@apache.org>.
LuisSanchez commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2737372964


##########
superset-frontend/src/dashboard/components/nativeFilters/selectors.test.ts:
##########
@@ -142,3 +147,421 @@ describe('getCrossFilterIndicator', () => {
     });
   });
 });
+
+test('extractLabel returns label when filter has label and it does not include undefined', () => {
+  expect(extractLabel({ label: 'My Label', value: 'x' })).toBe('My Label');
+  expect(extractLabel({ label: 'Only label' })).toBe('Only label');
+});
+
+test('extractLabel returns value joined by ", " when filter has non-empty array value and no label', () => {
+  expect(extractLabel({ value: ['a', 'b'] })).toBe('a, b');
+  expect(extractLabel({ value: ['single'] })).toBe('single');
+});
+
+test('extractLabel returns value when filter has non-array value (ensureIsArray wraps it)', () => {
+  expect(extractLabel({ value: 'scalar' })).toBe('scalar');
+  expect(extractLabel({ value: 42 })).toBe('42');
+});
+
+test('extractLabel returns null when filter is undefined or has no label and no value', () => {
+  expect(extractLabel(undefined)).toBe(null);
+  expect(extractLabel({})).toBe(null);
+  expect(extractLabel({ label: '' })).toBe(null);
+});
+
+test('extractLabel returns null when filter.value is null or undefined', () => {
+  expect(extractLabel({ value: null })).toBe(null);
+  expect(extractLabel({ value: undefined })).toBe(null);
+});
+
+test('extractLabel does not return ", " or "null, null" for arrays of only null, undefined, or empty string', () => {
+  expect(extractLabel({ value: [null, null] })).toBe(null);
+  expect(extractLabel({ value: [null] })).toBe(null);
+  expect(extractLabel({ value: [''] })).toBe(null);
+  expect(extractLabel({ value: ['', ''] })).toBe(null);
+  expect(extractLabel({ value: [null, ''] })).toBe(null);
+  expect(extractLabel({ value: [undefined, undefined] })).toBe(null);
+  expect(extractLabel({ value: [null, undefined, ''] })).toBe(null);
+  expect(extractLabel({ value: [null, null] })).not.toBe(', ');
+  expect(extractLabel({ value: [null, ''] })).not.toBe(', ');
+});
+
+test('extractLabel returns only non-empty items when array has mix of empty and non-empty', () => {
+  expect(extractLabel({ value: [null, 'a', '', 'b', undefined] })).toBe('a, b');
+  expect(extractLabel({ value: ['', 'x', ''] })).toBe('x');
+});
+
+test('extractLabel uses value when label is undefined', () => {
+  expect(extractLabel({ label: undefined, value: ['a'] })).toBe('a');
+});
+
+test('getAppliedColumnsWithFallback returns columns from query response when available', () => {
+  const chart = {
+    queriesResponse: [
+      {
+        applied_filters: [{ column: 'age' }, { column: 'name' }],
+      },
+    ],
+  };
+  const result = getAppliedColumnsWithFallback(chart);
+  expect(result).toEqual(new Set(['age', 'name']));
+});
+
+test('getAppliedColumnsWithFallback returns empty set when query response has no applied_filters and no fallback params', () => {
+  const chart = {
+    queriesResponse: [{ applied_filters: [] }],
+  };
+  const result = getAppliedColumnsWithFallback(chart);
+  expect(result).toEqual(new Set());
+});
+
+test('getAppliedColumnsWithFallback derives columns from native filters when query response is empty', () => {
+  const chart = {
+    queriesResponse: [{ applied_filters: [] }],
+  };
+  const nativeFilters = {
+    filter1: {
+      id: 'filter1',
+      type: NativeFilterType.NativeFilter,
+      chartsInScope: [123],
+      targets: [{ column: { name: 'age' } }],
+    },
+    filter2: {
+      id: 'filter2',
+      type: NativeFilterType.NativeFilter,
+      chartsInScope: [123],
+      targets: [{ column: { name: 'name' } }],
+    },
+  } as any;
+  const dataMask = {
+    filter1: {
+      id: 'filter1',
+      filterState: { value: '25' },
+      extraFormData: {},
+    },
+    filter2: {
+      id: 'filter2',
+      filterState: { value: 'John' },
+      extraFormData: {},
+    },
+  } as any;
+  const result = getAppliedColumnsWithFallback(
+    chart,
+    nativeFilters,
+    dataMask,
+    123,
+  );
+  expect(result).toEqual(new Set(['age', 'name']));
+});

Review Comment:
   In order to avoid more LOC to this PR, the newly added tests for the `getStatus` functions were removed from the original commit since the function is no longer modified.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(FiltersBadge): Enhance filter status calculation and add tests for native filters with no values [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #37260:
URL: https://github.com/apache/superset/pull/37260#issuecomment-3770829557

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | 8b8b8bc9f6b665ceebfa073bd3a33ca65075040a |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/696ef22e28563400084f3529 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-37260--superset-docs-preview.netlify.app](https://deploy-preview-37260--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTM3MjYwLS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.ClL_Kcl44Rd0IenIiuctOxGVWQWrXGsYzK3caQ_A6Is)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-37260--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org