codeant-ai-for-open-source[bot] commented on code in PR #40169: URL: https://github.com/apache/superset/pull/40169#discussion_r3248269351
########## superset-frontend/src/components/ListView/Filters/CompactSelectPanel.tsx: ########## @@ -0,0 +1,253 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { + forwardRef, + useImperativeHandle, + useMemo, + useRef, + useState, + useEffect, + type RefObject, +} from 'react'; +import { debounce } from 'lodash'; +import { t } from '@apache-superset/core/translation'; +import { useTheme, styled, css } from '@apache-superset/core/theme'; +import { Icons, Input, Constants, type InputRef } from '@superset-ui/core/components'; +import type { SelectOption, ListViewFilter as Filter } from '../types'; +import type { FilterHandler } from './types'; + +interface CompactSelectPanelProps { + selects?: Filter['selects']; + fetchSelects?: Filter['fetchSelects']; + value?: SelectOption; + onSelect: (option: SelectOption | undefined, isClear?: boolean) => void; + onClose?: () => void; + /** Injected by CompactFilterTrigger via cloneElement — true when dropdown is open */ + isOpen?: boolean; + /** External loading state from filter config */ + loading?: boolean; +} + +const PanelContainer = styled.div` + ${({ theme }) => css` + min-width: 220px; + max-width: 320px; Review Comment: **Suggestion:** The panel width is hardcoded to `220-320px`, which drops existing per-filter popup sizing behavior and truncates options on views that configured wider dropdowns. Honor a passed style/width prop instead of fixed bounds. [css layout issue] <details> <summary><b>Severity Level:</b> Major ⚠️</summary> ```mdx - ⚠️ Role filters ignore configured wider dropdown widths. - ⚠️ Long option labels truncate in compact select panels. ``` </details> <details> <summary><b>Steps of Reproduction ✅ </b></summary> ```mdx 1. In RolesList, note the filters definition at `superset-frontend/src/pages/RolesList/index.tsx:77-120`, where several `input: 'select'` filters (`Users`, `Permissions`, `Groups`) specify `popupStyle: { minWidth: WIDER_DROPDOWN_WIDTH }` to widen their dropdowns for long option labels. 2. RolesList passes this `filters` array into `ListView` (`superset-frontend/src/pages/RolesList/index.tsx:84-101`), which forwards it to `FilterControls` at `superset-frontend/src/components/ListView/ListView.tsx:413-420`. In `UIFilters` (`superset-frontend/src/components/ListView/Filters/index.tsx:77-95`), `popupStyle` is destructured from each filter but is never passed to `CompactFilterTrigger` or `CompactSelectPanel` when rendering `input === 'select'`. 3. `CompactSelectPanel` defines its container styles in `PanelContainer` at `superset-frontend/src/components/ListView/Filters/CompactSelectPanel.tsx:47-52`, hard-coding `min-width: 220px;` and `max-width: 320px;` and not accepting any style/width props from the filter configuration. 4. At runtime, open the "Users" select pill on the Roles list view: the dropdown panel always constrains itself to 220–320px wide despite the `popupStyle` configuration, and longer user/permission/group labels are visibly truncated or wrapped in an overly narrow panel, whereas the previous select implementation allowed these dropdowns to be wider according to `popupStyle`. ``` </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fcomponents%2FListView%2FFilters%2FCompactSelectPanel.tsx%0A%2A%2ALine%3A%2A%2A%2049%3A50%0A%2A%2AComment%3A%2A%2A%0A%09%2ACss%20Layout%20Issue%3A%20The%20panel%20width%20is%20hardcoded%20to%20%60220-320px%60%2C%20which%20drops%20existing%20per-filter%20popup%20sizing%20behavior%20and%20truncates%20options%20on%20views%20that%20configured%20wider%20dropdowns.%20Honor%20a%20passed%20style%2Fwidth%20prop%20instead%20of%20fixed%20bounds.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20o f%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fcomponents%2FListView%2FFilters%2FCompactSelectPanel.tsx%0A%2A%2ALine%3A%2A%2A%2049%3A50%0A%2A%2AComment%3A%2A%2A%0A%09%2ACss%20Layout%20Issue%3A%20The%20panel%20width%20is%20hardcoded%20to%20%60220-320px%60%2C%20which%20drops%20existing%20per-filter%20popup%20sizing%20behavior%20and%20truncates%20options%20on%20views%20that%20configured%20wider%20dropdowns.%20Honor%20a%20passed%20style%2Fwidth%20prop%20instead%20of%20fixed%20bounds.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it% 20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent 🤖 </b></summary> ```mdx This is a comment left during a code review. **Path:** superset-frontend/src/components/ListView/Filters/CompactSelectPanel.tsx **Line:** 49:50 **Comment:** *Css Layout Issue: The panel width is hardcoded to `220-320px`, which drops existing per-filter popup sizing behavior and truncates options on views that configured wider dropdowns. Honor a passed style/width prop instead of fixed bounds. Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40169&comment_hash=3f699e2ae4ff564d5e590db91ed88992a3eeef5195903f2744f9ca3ceddd54e0&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40169&comment_hash=3f699e2ae4ff564d5e590db91ed88992a3eeef5195903f2744f9ca3ceddd54e0&reaction=dislike'>👎</a> ########## superset-frontend/src/components/ListView/Filters/CompactSelectPanel.tsx: ########## @@ -0,0 +1,253 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { + forwardRef, + useImperativeHandle, + useMemo, + useRef, + useState, + useEffect, + type RefObject, +} from 'react'; +import { debounce } from 'lodash'; +import { t } from '@apache-superset/core/translation'; +import { useTheme, styled, css } from '@apache-superset/core/theme'; +import { Icons, Input, Constants, type InputRef } from '@superset-ui/core/components'; +import type { SelectOption, ListViewFilter as Filter } from '../types'; +import type { FilterHandler } from './types'; + +interface CompactSelectPanelProps { + selects?: Filter['selects']; + fetchSelects?: Filter['fetchSelects']; + value?: SelectOption; + onSelect: (option: SelectOption | undefined, isClear?: boolean) => void; + onClose?: () => void; + /** Injected by CompactFilterTrigger via cloneElement — true when dropdown is open */ + isOpen?: boolean; + /** External loading state from filter config */ + loading?: boolean; +} + +const PanelContainer = styled.div` + ${({ theme }) => css` + min-width: 220px; + max-width: 320px; + max-height: 320px; + display: flex; + flex-direction: column; + border-radius: ${theme.borderRadius}px; + overflow: hidden; + background: ${theme.colorBgContainer}; + box-shadow: ${theme.boxShadowSecondary}; + padding: ${theme.sizeUnit * 2}px; + + .ant-input-affix-wrapper { + margin-bottom: ${theme.sizeUnit * 2}px; + } + `} +`; + +const OptionList = styled.ul` + ${({ theme }) => css` + margin: 0; + padding: 0; + overflow-y: auto; + flex: 1; + list-style: none; + `} +`; + +const OptionItem = styled.li<{ $active: boolean }>` + ${({ theme, $active }) => css` + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 ${theme.sizeUnit * 3}px; + min-height: 35px; + cursor: pointer; + font-size: ${theme.fontSizeSM}px; + color: ${$active ? theme.colorPrimary : theme.colorText}; + background: ${$active ? theme.colorPrimaryBg : 'transparent'}; + transition: background 0.15s; + + &:hover { + background: ${$active ? theme.colorPrimaryBgHover : theme.colorFillAlter}; + } + `} +`; + +const OptionLabel = styled.span` + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + max-width: 240px; +`; + +const StatusText = styled.div` + ${({ theme }) => css` + padding: ${theme.sizeUnit * 2}px; + text-align: center; + color: ${theme.colorTextDisabled}; + font-size: ${theme.fontSizeSM}px; + `} +`; + +function CompactSelectPanel( + { + selects = [], + fetchSelects, + value, + onSelect, + onClose, + isOpen, + loading: externalLoading, + }: CompactSelectPanelProps, + ref: RefObject<FilterHandler>, +) { + const theme = useTheme(); + const inputRef = useRef<InputRef>(null); + const [search, setSearch] = useState(''); + const [debouncedSearch, setDebouncedSearch] = useState(''); + const [remoteOptions, setRemoteOptions] = useState<SelectOption[]>([]); + const [internalLoading, setInternalLoading] = useState(false); + const [selectedOption, setSelectedOption] = useState< + SelectOption | undefined + >(value); + + const isLoading = externalLoading || internalLoading; + + const debouncedSetSearch = useMemo( + () => debounce(setDebouncedSearch, Constants.FAST_DEBOUNCE), + [], + ); + + // Sync selected state when external value changes (e.g. clearFilters called from parent) + useEffect(() => { + setSelectedOption(value); + }, [value]); + + // Focus search input when dropdown opens; reset search when it closes + useEffect(() => { + let timeoutId: ReturnType<typeof setTimeout>; + if (isOpen) { + timeoutId = setTimeout(() => { + inputRef.current?.input?.focus({ preventScroll: true }); + }, 100); + } else { + setSearch(''); + setDebouncedSearch(''); + } + return () => { + if (timeoutId) clearTimeout(timeoutId); + }; + }, [isOpen]); + + // Fetch remote options when debounced search changes + useEffect(() => { + if (!fetchSelects) return; + setInternalLoading(true); + fetchSelects(debouncedSearch, 0, 50) + .then(result => { + setRemoteOptions(result.data); + }) + .finally(() => setInternalLoading(false)); Review Comment: **Suggestion:** Async option loading has a response-order race: older requests can resolve after newer ones and overwrite `remoteOptions` with stale results. Track a request id (or cancel previous requests) and only apply results from the latest search term. [race condition] <details> <summary><b>Severity Level:</b> Major ⚠️</summary> ```mdx - ⚠️ Async select filters can show stale search results. - ⚠️ Users may select options from outdated result sets. ``` </details> <details> <summary><b>Steps of Reproduction ✅ </b></summary> ```mdx 1. Open the Roles list view rendered by `ListView` in `superset-frontend/src/pages/RolesList/index.tsx` (see `<ListView<RoleObject> ... filters={filters} />` around lines 300-419) which passes the `filters` array defined around lines 180-210, including several `input: 'select'` filters with `fetchSelects` async functions. 2. `ListView` forwards these `filters` into `FilterControls` (`UIFilters`) at `superset-frontend/src/components/ListView/ListView.tsx:413-420`, and `UIFilters` renders each `input === 'select'` filter using `<CompactFilterTrigger><CompactSelectPanel ... /></CompactFilterTrigger>` at `superset-frontend/src/components/ListView/Filters/index.tsx:100-135`, passing the same `fetchSelects` function into `CompactSelectPanel`. 3. In `CompactSelectPanel`, the debounced search term is managed via `search`/`debouncedSearch` and the search input `onChange` at `superset-frontend/src/components/ListView/Filters/CompactSelectPanel.tsx:200-215`; each change updates `search` immediately and triggers `debouncedSetSearch`, which in turn drives the `useEffect` that calls `fetchSelects(debouncedSearch, 0, 50)` at lines 161-169. 4. Type quickly in an async select pill (e.g., in the Roles list "Users" filter): type `"adm"` then quickly backspace to `"ad"` or change to another string before the first request resolves. Multiple `fetchSelects` calls are in flight, and because the `then` handler at lines 165-167 unconditionally calls `setRemoteOptions(result.data)` without checking which search term it corresponds to, a slower, older response can arrive last and overwrite `remoteOptions` with stale results that no longer match the current `search` value, causing the dropdown options to be out of sync with the current query. ``` </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fcomponents%2FListView%2FFilters%2FCompactSelectPanel.tsx%0A%2A%2ALine%3A%2A%2A%20165%3A169%0A%2A%2AComment%3A%2A%2A%0A%09%2ARace%20Condition%3A%20Async%20option%20loading%20has%20a%20response-order%20race%3A%20older%20requests%20can%20resolve%20after%20newer%20ones%20and%20overwrite%20%60remoteOptions%60%20with%20stale%20results.%20Track%20a%20request%20id%20%28or%20cancel%20previous%20requests%29%20and%20only%20apply%20results%20from%20the%20latest%20search%20term.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20 wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fcomponents%2FListView%2FFilters%2FCompactSelectPanel.tsx%0A%2A%2ALine%3A%2A%2A%20165%3A169%0A%2A%2AComment%3A%2A%2A%0A%09%2ARace%20Condition%3A%20Async%20option%20loading%20has%20a%20response-order%20race%3A%20older%20requests%20can%20resolve%20after%20newer%20ones%20and%20overwrite%20%60remoteOptions%60%20with%20stale%20results.%20Track%20a%20request%20id%20%28or%20cancel%20previous%20requests%29%20and%20only%20apply%20results%20from%20the%20latest%20search%20term.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%2 0propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent 🤖 </b></summary> ```mdx This is a comment left during a code review. **Path:** superset-frontend/src/components/ListView/Filters/CompactSelectPanel.tsx **Line:** 165:169 **Comment:** *Race Condition: Async option loading has a response-order race: older requests can resolve after newer ones and overwrite `remoteOptions` with stale results. Track a request id (or cancel previous requests) and only apply results from the latest search term. Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40169&comment_hash=01801b933bba80b2aed973379e55173038fdfbc4820fdf2cfc06321422c084ff&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40169&comment_hash=01801b933bba80b2aed973379e55173038fdfbc4820fdf2cfc06321422c084ff&reaction=dislike'>👎</a> ########## superset-frontend/src/components/ListView/Filters/index.tsx: ########## @@ -145,30 +156,67 @@ function UIFilters( ); } if (input === 'datetime_range') { + const hasDateValue = + Array.isArray(filterValue) && filterValue.some(Boolean); + const dateTooltip = hasDateValue + ? (filterValue as (string | number)[]).filter(Boolean).join(' – ') + : undefined; return ( - <DateRangeFilter - ref={filterRefs[index]} - Header={Header} - initialValue={initialValue} + <CompactFilterTrigger key={key} - name={id} - onSubmit={value => updateFilterValue(index, value)} - dateFilterValueType={dateFilterValueType || 'unix'} - /> + label={Header} + hasValue={hasDateValue} + tooltipTitle={dateTooltip} + onClear={() => { + filterRefs[index]?.current?.clearFilter?.(); + updateFilterValue(index, undefined); + }} + > + <FilterPopoverContent> + <DateRangeFilter + ref={filterRefs[index]} + Header={Header} + initialValue={initialValue} + name={id} + onSubmit={value => updateFilterValue(index, value)} + dateFilterValueType={dateFilterValueType || 'unix'} + /> + </FilterPopoverContent> + </CompactFilterTrigger> ); } if (input === 'numerical_range') { + const hasRangeValue = + Array.isArray(filterValue) && + filterValue.some(v => v !== null && v !== undefined); + const rangeTooltip = hasRangeValue + ? (filterValue as (number | null | undefined)[]) + .filter(v => v !== null && v !== undefined) + .join(' – ') + : undefined; return ( - <NumericalRangeFilter - ref={filterRefs[index]} - Header={Header} - initialValue={initialValue} - min={min} - max={max} + <CompactFilterTrigger key={key} - name={id} - onSubmit={value => updateFilterValue(index, value)} - /> + label={Header} + hasValue={hasRangeValue} + tooltipTitle={rangeTooltip} + onClear={() => { + filterRefs[index]?.current?.clearFilter?.(); + updateFilterValue(index, undefined); + }} Review Comment: **Suggestion:** Clearing a numerical range triggers two updates: `clearFilter()` submits `[null, null]` first, then `updateFilterValue(..., undefined)` runs immediately after. This causes an unnecessary intermediate filter state (and extra fetch) before the real clear; use only one clear path. [logic error] <details> <summary><b>Severity Level:</b> Major ⚠️</summary> ```mdx - ⚠️ Clearing numeric or date range issues two filter updates. - ⚠️ Extra backend fetch and pagination reset per clear action. ``` </details> <details> <summary><b>Steps of Reproduction ✅ </b></summary> ```mdx 1. In UsersList, the filters configuration at `superset-frontend/src/pages/UsersList/index.tsx:26-40` defines multiple range filters: `input: 'datetime_range'` for dates and `input: 'numerical_range'` for "Login count" and "Fail login count" (lines 26-40). 2. UsersList passes these `filters` into `ListView` (`superset-frontend/src/pages/UsersList/index.tsx:585-591`), which forwards them to `FilterControls` (`UIFilters`) at `superset-frontend/src/components/ListView/ListView.tsx:413-420`. For `input === 'numerical_range'`, `UIFilters` renders `CompactFilterTrigger` with an `onClear` handler that calls both `filterRefs[index]?.current?.clearFilter?.();` and `updateFilterValue(index, undefined);` at `superset-frontend/src/components/ListView/Filters/index.tsx:198-206`. 3. The underlying `NumericalRangeFilter` component implements `clearFilter` to set its internal value to `[null, null]` and immediately invoke `onSubmit([null, null])` at `superset-frontend/src/components/ListView/Filters/NumericalRange.tsx:92-97`; `UIFilters` wires this `onSubmit` to `updateFilterValue(index, value)` at lines 209-217, so calling `clearFilter()` already applies the `[null, null]` value via `updateFilterValue`. 4. `updateFilterValue` is `applyFilterValue` from `useListViewState` (`superset-frontend/src/components/ListView/utils.ts:95-113`), which updates `internalFilters`, calls `setAllFilters(convertFilters(updatedFilters));` and `gotoPage(0);` – triggering `fetchData` via the effect at lines 51-87. When the pill clear button is clicked, the sequence is: first `clearFilter()` applies `[null, null]` and triggers a fetch; then `updateFilterValue(index, undefined)` applies a second value (`undefined`, which is not `===` to `[null, null]`), causing `applyFilterValue` to run again and trigger a second request and filters update for the same user action. ``` </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fcomponents%2FListView%2FFilters%2Findex.tsx%0A%2A%2ALine%3A%2A%2A%20203%3A206%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20Clearing%20a%20numerical%20range%20triggers%20two%20updates%3A%20%60clearFilter%28%29%60%20submits%20%60%5Bnull%2C%20null%5D%60%20first%2C%20then%20%60updateFilterValue%28...%2C%20undefined%29%60%20runs%20immediately%20after.%20This%20causes%20an%20unnecessary%20intermediate%20filter%20state%20%28and%20extra%20fetch%29%20before%20the%20real%20clear%3B%20use%20only%20one%20clear%20path.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same %20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fcomponents%2FListView%2FFilters%2Findex.tsx%0A%2A%2ALine%3A%2A%2A%20203%3A206%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20Clearing%20a%20numerical%20range%20triggers%20two%20updates%3A%20%60clearFilter%28%29%60%20submits%20%60%5Bnull%2C%20null%5D%60%20first%2C%20then%20%60updateFilterValue%28...%2C%20undefined%29%60%20runs%20immediately%20after.%20This%20causes%20an%20unnecessary%20intermediate%20filter%20state%20%28and%20extra%20fetch%29%20before%20the%20real%20clear%3B%20use%20only%20one%20clear%20path.%0A%0AValidate%20the%20correctness% 20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent 🤖 </b></summary> ```mdx This is a comment left during a code review. **Path:** superset-frontend/src/components/ListView/Filters/index.tsx **Line:** 203:206 **Comment:** *Logic Error: Clearing a numerical range triggers two updates: `clearFilter()` submits `[null, null]` first, then `updateFilterValue(..., undefined)` runs immediately after. This causes an unnecessary intermediate filter state (and extra fetch) before the real clear; use only one clear path. Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40169&comment_hash=9854062ad99d463f68eb18766453cafe2beb4ab2adf36c77ef6bb097ca2f4c0f&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40169&comment_hash=9854062ad99d463f68eb18766453cafe2beb4ab2adf36c77ef6bb097ca2f4c0f&reaction=dislike'>👎</a> -- 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]
