-
Notifications
You must be signed in to change notification settings - Fork 15.4k
fix(dashboard): adds dependent filter select first value fixes #34137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(dashboard): adds dependent filter select first value fixes #34137
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Status |
---|---|---|
Improve cascade filter check comment ▹ view | 🧠 Not in standard | |
Parent Filter Value Count Uses Default Instead of Current State ▹ view | 🧠 Not in scope | |
Inefficient JSON.stringify in Dependency Array ▹ view | 🧠 Not in scope | |
Filter state not updating after parent filter changes ▹ view | 🧠 Not in scope | |
Incomplete data change detection ▹ view | 🧠 Incorrect | |
Inaccurate Time Range Dependency Counting ▹ view | 🧠 Incorrect |
Files scanned
File Path | Reviewed |
---|---|
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx | ✅ |
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
Outdated
Show resolved
Hide resolved
...set-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
Outdated
Show resolved
Hide resolved
...set-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
Outdated
Show resolved
Hide resolved
...set-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
Show resolved
Hide resolved
da85911
to
6e2dba4
Compare
* adds a fix for correctly selecting first value of a dependent filter * adds a fix for automatically selecting the correct dependent filter value on changing parent filter value * adds dependent filters fix support for time range filter
af7768f
to
16646e8
Compare
Hi @betodealmeida @eschutho — the Could one of you re-trigger the check? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Status |
---|---|---|
Incorrect Parent Filter Count Logic ▹ view | 🧠 Not in scope | |
Incomplete JSON stringification error handling ▹ view | 🧠 Not in scope | |
Incomplete Multi-select Value Validation ▹ view | 🧠 Not in standard | |
Inefficient Data Change Detection ▹ view | 🧠 Incorrect |
Files scanned
File Path | Reviewed |
---|---|
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx | ✅ |
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
const stringifySafe = (val: unknown) => | ||
typeof val === 'bigint' ? val.toString() : val; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
const stringifySafe = (val: unknown) => | ||
typeof val === 'bigint' ? val.toString() : val; | ||
|
||
const hasDataChanged = | ||
prev?.length !== curr?.length || | ||
JSON.stringify(prev?.map(row => stringifySafe(row[col]))) !== | ||
JSON.stringify(curr?.map(row => stringifySafe(row[col]))); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
useEffect(() => { | ||
if ( | ||
isChangedByUser.current && | ||
filterState.value && | ||
data.some(row => row[col] === filterState.value[0]) | ||
) | ||
return; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
let selectedParentFilterValueCounts = 0; | ||
|
||
filter?.cascadeParentIds?.forEach(pId => { | ||
if ( | ||
dataMaskSelected?.[pId]?.extraFormData?.filters || | ||
dataMaskSelected?.[pId]?.extraFormData?.time_range | ||
) { | ||
selectedParentFilterValueCounts += | ||
dataMaskSelected?.[pId]?.extraFormData?.filters?.length ?? 1; | ||
} | ||
}); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Commit message:
SUMMARY
These fixes address issues with dependent filters using the "Select first filter value by default" option:
FilterValue.tsx: Prevents child filters from requesting data before their parent values are set. The request is now delayed until all parent filter data is available, ensuring correct first value selection.
SelectFilterPlugin: Ensures the first value is correctly updated when parent filter values change. A post-check hook verifies external data changes and selects the appropriate default.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE
AFTER
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION