Skip to content

fix: respect custom filterFn.autoRemove over default empty string check#6195

Open
isaackaara wants to merge 1 commit intoTanStack:mainfrom
isaackaara:fix/filter-auto-remove-empty-string
Open

fix: respect custom filterFn.autoRemove over default empty string check#6195
isaackaara wants to merge 1 commit intoTanStack:mainfrom
isaackaara:fix/filter-auto-remove-empty-string

Conversation

@isaackaara
Copy link

When a custom filterFn provides an autoRemove function, its return value should be the sole authority on whether to remove the filter. Previously, the default checks (undefined value, empty string) were OR'd with the custom autoRemove result, making it impossible to filter for empty strings even when autoRemove explicitly returned false.

Before:

return (
  (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) ||
  typeof value === 'undefined' ||
  (typeof value === 'string' && !value)
)

After:

if (filterFn && filterFn.autoRemove) {
  return filterFn.autoRemove(value, column)
}

return typeof value === 'undefined' || (typeof value === 'string' && !value)

This is a non-breaking change for built-in filter functions since they already handle empty values via testFalsey in their own autoRemove implementations.

Fixes #6101

When a custom filterFn provides an autoRemove function, its return
value should be the sole authority on whether to remove the filter.
Previously, the default checks (undefined value, empty string) were
OR'd with the custom autoRemove result, making it impossible to
filter for empty strings even when autoRemove explicitly returned
false.

This restructures the logic so that when a custom autoRemove exists,
only its result is used. The default undefined/empty-string checks
only apply when no custom autoRemove is provided. This matches the
behavior of the built-in filter functions which already handle
empty values via testFalsey in their own autoRemove implementations.

Fixes TanStack#6101
@changeset-bot
Copy link

changeset-bot bot commented Mar 6, 2026

⚠️ No Changeset found

Latest commit: 141e691

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6a91ffc2-2724-4e55-9d0c-d0917d0d499e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant