You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: [data-view, filter-chip] start text filters on contains - #1025
A new text filter in DataView started on is, so a partial value hid every row until the user switched the operator to contains.
resolveDefaultFilterOperation in shared/filter-operations returns the operation a new filter starts with: the first operation a field sets through filterOperations, else contains when the type offers it, else the first operation of the type.
The DataView and DataTable useFilters hooks seed new filters through it, and a FilterChip that sets no operations starts on the same default.
Tests cover the helper, the chip start operation, and a text filter added through the DataView toolbar. The FilterChip docs page states the new default.
No actionable comments were generated in the recent review.
Walkthrough
When no custom operations are configured, string filters now default to contains when that operation is available. Other filter types use their first available operation if contains is unavailable. Custom operation lists continue to use their first entry unless defaultOperation is provided. DataView filter creation uses the same default-selection helper. Tests and documentation cover the updated behavior.
New text filters start with "contains", so partial values match rows by default. No actionable merge risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: text (string) filters in DataView and FilterChip now start on the contains operation. It matches the raw summary, which shows useFilters seeding new filters through re…
Description check
The description states the problem (new text filters started on is and hid partial matches), the new resolveDefaultFilterOperation helper, the useFilters and FilterChip changes, the tests, and the doc…
Linked Issues check
Issue #940 asks that new text filters not start on is. It offers two options: default string filters to contains, or let a field set its starting operator, with both onAddFilter and FilterChip…
Out of Scope Changes check
The changed files relate to the #940 fix: - filter-operations.ts: adds resolveDefaultFilterOperation, the shared default-selection rule. - data-view/hooks/useFilters.tsx: seeds new filters throu…
Full details: Title check
Explanation
The title names the main change: text (string) filters in DataView and FilterChip now start on the contains operation. It matches the raw summary, which shows useFilters seeding new filters through resolveDefaultFilterOperation, the FilterChip default change, and tests for contains as the starting operation.
Full details: Description check
Explanation
The description states the problem (new text filters started on is and hid partial matches), the new resolveDefaultFilterOperation helper, the useFilters and FilterChip changes, the tests, and the docs update. It matches the raw summary and the objectives, and it links issue #940.
Full details: Linked Issues check
Explanation
Issue #940 asks that new text filters not start on is. It offers two options: default string filters to contains, or let a field set its starting operator, with both onAddFilter and FilterChip respecting that choice.
At the reviewed head:
resolveDefaultFilterOperation in packages/react/shared/filter-operations.ts returns the first entry of a field's filterOperations when set. Otherwise it returns the contains operation when the type offers it, and the first operation of the type when it does not. This covers both options from #940.
onAddFilter in packages/react/components/data-view/hooks/useFilters.tsx calls resolveDefaultFilterOperation(filterType, field.filterOperations) and sets operator to defaultFilter.value. A new string filter therefore starts on contains unless the field sets its own operations.
The change since the previous review moves this call from resolveFilterOperations(...)[0] to the new helper. The helper's result is still used as the operator, so the behavior is preserved.
Per the change summary, FilterChip in packages/react/components/filter-chip/filter-chip.tsx applies the same rule when operations is unset. Tests in filter-chip.test.tsx, filter-operations.test.ts, and data-view.test.tsx cover the helper, the chip start operation, and the DataView add-filter path.
The PR description names a DataTable useFilters hook. No file exists at packages/react/components/data-table/hooks/useFilters.tsx at the base or the reviewed head, and no data-table file appears in the change summary. This is a description inaccuracy. It does not affect #940, which concerns DataView. No unmet coding requirement was found.
Full details: Out of Scope Changes check
Explanation
The changed files relate to the #940 fix:
filter-operations.ts: adds resolveDefaultFilterOperation, the shared default-selection rule.
data-view/hooks/useFilters.tsx: seeds new filters through the helper.
filter-chip.tsx: applies the same default when operations is unset, and documents defaultOperation.
Test files: cover the helper, the chip start operation, and the DataView add-filter path.
apps/www/src/content/docs/components/filter-chip/index.mdx: documents the new default. This follows directly from the behavior change.
The change summary lists no data-table file, so no unrelated DataTable change is shown. The PR description's DataTable reference does not match the repository (see the linked-issue assessment). No unrelated behavior change was identified.
Finishing Touches
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
is, so a partial value hid every row until the user switched the operator tocontains.resolveDefaultFilterOperationinshared/filter-operationsreturns the operation a new filter starts with: the first operation a field sets throughfilterOperations, elsecontainswhen the type offers it, else the first operation of the type.useFiltershooks seed new filters through it, and aFilterChipthat sets nooperationsstarts on the same default.Closes #940