Keep commas in search filter values - #4496
Conversation
|
@justadityaraj is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR preserves commas in scalar search-filter values and adds a regression test for regex quantifiers. The initialization fix is incomplete when an already-mounted filter changes operators.
Confidence Score: 4/5The operator-transition truncation should be fixed before merging because users can still lose the comma-containing portion of an edited filter. FilterRecord derives its local selection from the operator only during initial mounting, while its parent preserves the component instance when operators change, leaving the reported truncation reachable through the editor. Files Needing Attention: src/components/common/FilterRecord.tsx
|
| Filename | Overview |
|---|---|
| src/components/common/FilterRecord.tsx | Preserves comma-containing search values on initial mount, but local selection state is not recalculated when the operator changes. |
| src/components/common/FilterRecord.test.tsx | Adds focused coverage for initial rendering of a regex containing a comma, but does not cover an in-place operator transition. |
Reviews (1): Last reviewed commit: "fix(filters): preserve commas in search ..." | Re-trigger Greptile
| const initValues = Array.isArray(value) | ||
| ? value | ||
| : value | ||
| ? isSearch | ||
| ? [value] | ||
| : value.split(',') | ||
| : []; | ||
| const [selected, setSelected] = useState<string[]>(initValues); |
There was a problem hiding this comment.
Operator changes retain split state
When a comma-containing multi-value filter is changed to a search operator, the stable component instance retains its initially split selected state, so the search field displays only the prefix before the comma and subsequent editing can overwrite the complete value.
There was a problem hiding this comment.
Fixed in 8928c5f. The selected state now resynchronizes from the full value whenever the operator changes; the regression covers eq to re with a comma-bearing quantifier.
Problem
Editing a search filter initialized every string value by splitting on commas. Regex quantifiers such as
{21,22}were therefore truncated in the input even though the URL parser had preserved the full expression.Fix
Keep search-operator values as one string when initializing
FilterRecord; retain comma splitting for the existing multi-value operators. Add a component regression using the reported regex shape.User impact
Regex, contains, and other free-text filter values containing commas remain fully visible and editable instead of showing only the prefix before the first comma.
Verification
tsc --noEmitpassed after generating the Prisma client with a placeholder local database URL.git diff --checkpassed.Fixes #4489
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.