You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mistercrunch (via GitHub)" <gi...@apache.org> on 2026/04/21 04:50:33 UTC

[PR] fix(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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

   ### SUMMARY
   
   Dashboard filters configured as a dependency chain (e.g. `A -> B -> C -> D`, where each level lists only its direct parent in `cascadeParentIds`) were applying only a partial filter set to charts on the first Apply. The user had to click Apply a second time to get the correct result.
   
   **Root cause:** `useFilterDependencies` in `FilterBar/FilterControls/state.ts` only iterated a filter's *direct* `cascadeParentIds`. For a chain `A -> B -> C -> D`, D's emitted `extra_form_data` reflected only C's state, not A's and B's, so downstream charts received a partial filter set until the cascade had fully re-settled on a second Apply. The readiness guard in `FilterValue.tsx` suffered from the same single-hop assumption, so its value-count check could disagree with the merged dependencies.
   
   **Fix:**
   - New `resolveTransitiveParentIds` function walks the full ancestor graph depth-first, with a `visited` set for cycle protection.
   - `useFilterDependencies` now merges `extraFormData` across the *entire* transitive chain in topological order.
   - Extracted `useTransitiveParentIds` hook, used by both `useFilterDependencies` and the readiness guard in `FilterValue`, so the two views always agree on which parents count.
   
   Shortcut: sc-102912
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — behavior-only fix, no UI change.
   
   ### TESTING INSTRUCTIONS
   
   1. Create a dashboard with four native filters A, B, C, D where:
      - B depends on A
      - C depends on B
      - D depends on C
   2. Add at least one chart that uses all four filters.
   3. Set values for A, then B, then C, then D in order.
   4. Click Apply once.
   5. **Before this fix:** the chart is filtered by only a subset of the selected values; a second Apply is needed.
   6. **After this fix:** the chart correctly reflects all four filter selections on the first Apply.
   
   Automated coverage: `superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/state.test.ts` covers linear chains, diamond-shaped shared ancestors, cycle protection, missing filter entries, and end-to-end `extra_form_data` merging. All 8 tests pass.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] 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(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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

   This is a well-structured bug fix. The problem and solution are clearly described.                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                             
     What it does right:                                                                                                                                                                                                                                                                   
     - Correctly identifies the single-hop bug in useFilterDependencies — it only iterated direct cascadeParentIds, missing grandparent+ ancestors in chains like A→B→C→D                                                                                                                    
     - Extracts resolveTransitiveParentIds into a standalone dependencyGraph.ts module — clean separation, reusable outside React hooks                                                                                                                                                      
     - Cycle protection via visited set — defensive against malformed saved configs                                                    
     - Topological ordering (furthest ancestor first) is correct for mergeExtraFormData — scalar fields like time_range get overridden by closer parents, which is the right precedence                                                                                                      
     - The useTransitiveParentIds hook is shared between useFilterDependencies and FilterValue's readiness guard, so they always agree                                                                                                                                                       
     - Tests are thorough: linear chain, diamond, cycle, missing entries, full extraFormData merging, scalar override precedence, empty state                                                                                                                                                
                                                                                                                                                                                                                                                                                             
     Potential concerns:                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                             
     1. FilterValue.tsx line 131 — stale hasDeps check: The existing line const hasDeps = Boolean(filter.cascadeParentIds?.length) still checks only direct parents. After this PR, a filter with no direct parents but indirect ancestors (unlikely but theoretically possible with         
     malformed config) would set hasDeps = false while transitiveParentIds.length > 0. This is probably fine since the filter config modal enforces direct parent references, but worth noting.                                                                                              
     2. shallowEqual on filterConfig in useTransitiveParentIds: The selector grabs the entire state.nativeFilters.filters object with shallowEqual. If any filter's config changes (even unrelated ones), this will recompute all transitive parent chains for every mounted filter. For     
     dashboards with many filters this could cause unnecessary re-renders. A more targeted selector that only reads the cascadeParentIds of the relevant ancestors could be more efficient — though this is a minor optimization concern, not a correctness issue.                           
     3. useEffect dependency array in FilterValue.tsx: transitiveParentIds is added to the dependency array (line 295). Since useMemo returns a new array reference whenever filterConfig changes (due to shallowEqual comparison), this could trigger the effect more often than needed. A
     deep equality check or stable reference would help, but again, minor. 


-- 
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(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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

   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(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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

   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(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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

   I wonder if this would fix https://github.com/apache/superset/issues/24511 ?


-- 
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(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/39504?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 `91.30435%` with `2 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 64.45%. Comparing base ([`151d7d7`](https://app.codecov.io/gh/apache/superset/commit/151d7d76da2855a7c6c6c83e670e0f367f62a55e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`5a10b2a`](https://app.codecov.io/gh/apache/superset/commit/5a10b2a47ddfa2cdf2f48704ce65bce2cb76f3ab?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/39504?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...veFilters/FilterBar/FilterControls/FilterValue.tsx](https://app.codecov.io/gh/apache/superset/pull/39504?src=pr&el=tree&filepath=superset-frontend%2Fsrc%2Fdashboard%2Fcomponents%2FnativeFilters%2FFilterBar%2FFilterControls%2FFilterValue.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyQmFyL0ZpbHRlckNvbnRyb2xzL0ZpbHRlclZhbHVlLnRzeA==) | 33.33% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/39504?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   #39504   +/-   ##
   =======================================
     Coverage   64.44%   64.45%           
   =======================================
     Files        2560     2561    +1     
     Lines      133574   133591   +17     
     Branches    31017    31018    +1     
   =======================================
   + Hits        86082    86102   +20     
   + Misses      45999    45996    -3     
     Partials     1493     1493           
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/39504/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/39504/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.45% <91.30%> (+0.01%)` | :arrow_up: |
   
   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/39504?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(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/24740038453) for [5a10b2a](https://github.com/apache/superset/commit/5a10b2a)


-- 
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(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/24740038453) for [5a10b2a](https://github.com/apache/superset/commit/5a10b2a)
   
   • **Environment:** http://54.186.126.185:8080 (admin/admin)
   • **Lifetime:** 48h auto-cleanup
   • **Updates:** New commits create fresh environments automatically


-- 
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(dashboard): apply full transitive ancestor chain for dependent filters [superset]

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


-- 
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