rusackas commented on code in PR #40978:
URL: https://github.com/apache/superset/pull/40978#discussion_r3523801085
##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx:
##########
@@ -226,6 +231,22 @@ const FilterValue: FC<FilterValueProps> = ({
// direct parents) so the counts line up with `dependencies`, which is
// itself built from the transitive chain by `useFilterDependencies`.
+ // Block if any parent with defaultToFirstItem hasn't auto-selected yet.
+ // Without this, the child fetches unfiltered options before the parent
+ // auto-selects, leading to a stale first-value dispatch that never
+ // gets corrected because subsequent re-selections are not
first-initialization.
+ const hasDefaultFirstParentPending = transitiveParentIds.some(pId => {
Review Comment:
Tests landed in a later push... `FilterValue.test.tsx` covers the
pending-parent block, the unblock once the parent selects, and the
non-defaultToFirstItem passthrough.
##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx:
##########
@@ -228,6 +241,21 @@ const FilterValue: FC<FilterValueProps> = ({
// direct parents) so the counts line up with `dependencies`, which is
// itself built from the transitive chain by `useFilterDependencies`.
+ // Block if any parent with defaultToFirstItem hasn't auto-selected yet.
+ // Without this, the child fetches unfiltered options before the parent
+ // auto-selects, leading to a stale first-value dispatch that never
+ // gets corrected because subsequent re-selections are not
first-initialization.
+ const hasDefaultFirstParentPending = transitiveParentIds.some(pId => {
+ const parentMask = dataMaskSelected?.[pId];
+ return (
+ parentDefaultToFirstItem[pId] &&
+ parentMask?.filterState?.value === undefined
+ );
Review Comment:
I don't think we want this one... `null` here means an explicitly cleared
selection (deselect or Clear All), never the pending auto-select state, which
is always `undefined`. Treating `null` as pending would block the child
indefinitely after Clear All, since a cleared root parent can legitimately sit
at `null`. `checkIsMissingRequiredValue` serves the enableEmptyFilter
validation path, which is a separate concern.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]