Skip to content

fix: [data-view, filter-chip] start text filters on contains - #1025

Open
0xABCD01 wants to merge 1 commit into
raystack:mainfrom
0xABCD01:fix/940-dataview-text-filter-default-contains
Open

0xABCD01 wants to merge 1 commit into
raystack:mainfrom
0xABCD01:fix/940-dataview-text-filter-default-contains

Conversation

@0xABCD01

Copy link
Copy Markdown

Summary

  • 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.

Closes #940

@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown

@0xABCD01 is attempting to deploy a commit to the Raystack Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Sequence Diagram(s)

sequenceDiagram
  participant DataView
  participant onAddFilter
  participant resolveDefaultFilterOperation
  participant FilterChip
  DataView->>onAddFilter: Add string filter
  onAddFilter->>resolveDefaultFilterOperation: Resolve operation
  resolveDefaultFilterOperation-->>onAddFilter: Return contains
  onAddFilter-->>DataView: Create filter with contains
  DataView->>FilterChip: Render filter
Loading

Suggested reviewers: rsbh, rohanchkrabrty, shreyag02

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 0baea

New text filters start with "contains", so partial values match rows by default. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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.

Biome (2.6.5)

packages/react/components/filter-chip/filter-chip.tsx

Biome could not lint this file: configuration resulted in errors. Check the repository's Biome configuration and plugins.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8fdb5416-09cb-4708-a827-ebd8f18f51de
Commits

Reviewing files that changed from the base of the PR and between 5b51257 and 0baead5.

Files selected for processing: 1

  • packages/react/components/filter-chip/filter-chip.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@0xABCD01
0xABCD01 force-pushed the fix/940-dataview-text-filter-default-contains branch from 5b51257 to 0baead5 Compare November 26, 2026 09:30

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataView: text filters start on "is", so partial matches hide everything

1 participant