Analytics filter refinements#21
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| onSelect={() => { | ||
| if (isMultiSelect) { | ||
| const newValues = [...effectiveValues, option.value] as T[]; | ||
| var newValues = [...effectiveValues, option.value] as T[]; |
There was a problem hiding this comment.
Inconsistent use of var instead of const
Low Severity
The variable declaration at line 1125 uses var newValues while similar logic elsewhere in the same file (e.g., line 1266) uses const newValues. This inconsistency appears to be accidentally introduced since the diff shows this was changed from const to var. Using var is discouraged in modern JavaScript/TypeScript due to its function-scoped hoisting behavior, and the rest of the codebase consistently uses const/let.
| addButtonText={filters.length ? 'Add filter' : 'Filter'} | ||
| className='mb-6 mt-0.5 [&>button]:order-last' | ||
| addButtonIcon={<LucideIcon.FunnelPlus />} | ||
| addButtonText={filters.length ? '' : ''} |
There was a problem hiding this comment.
Redundant ternary expression always returns empty string
Low Severity
The expression filters.length ? '' : '' is a redundant ternary that evaluates to an empty string in both branches. This appears to be leftover code from when different text was shown based on the filter count. The ternary serves no purpose and reduces readability.
| icon: <LucideIcon.Users />, | ||
| options: audienceOptions.map(({value, label, icon}) => ({value, label, icon})) | ||
| options: audienceOptions.map(({value, label, icon}) => ({value, label, icon})), | ||
| defaultOperator: 'is any of', |
There was a problem hiding this comment.
Incorrect operator value format uses label instead of value
Medium Severity
The defaultOperator for the audience field is set to 'is any of' (with spaces), but operator values use underscores like 'is_any_of'. The filters component defines multiselect operators with values like {value: 'is_any_of', label: 'is any of'}. Using the label format instead of the value format means the filter will be created with an invalid operator that doesn't match any defined operator value.
Benchmark PR from qodo-benchmark#240
Note
Enhances filters UX and updates analytics filter configs.
autoCloseOnSelectfor multiselects; reset search on close; disable popover close animation; adjust small size padding; tweak operator label container bordersaddFilter/addFilterTitlestrings to allow icon-only buttonselectedOptionsClassName; width/class handling improvementsis any of, hides operator, auto-closes on select; Post filter icon and width updated; set Filters size tosm; useFunnelPlusicon with empty textWritten by Cursor Bugbot for commit dc86c90. Configure here.