Skip to content

Numeric column's automatic filter autoremove interferes with manual filtering #5901

Open
@Faithfinder

Description

@Faithfinder

TanStack Table version

8.20.6

Framework/Library version

18.3.0

Describe the bug and the steps to reproduce it

I'd like to implement filters with different operators for columns (e.g., a user can choose whether they want greater than or less than for numeric, for example). I'd also like to do filtering server side.

When I define a minimal column definition, the automatic filtering kicks in. Even with manualFilter turned on, autoremove logic still plays out.

For numeric columns, it treats an object as falsy due to (testFalsey(val[0]) && testFalsey(val[1]) condition.

There's a billion possible workarounds, but IMO the fix is to check whether val is an array first. This would still give bad results if somebody uses an array as filter value, but that use case is harder to imagine

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/edit/tanstack-table-8erjbq2f?file=src%2Fmain.tsx

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Yes, I am also opening a PR that solves the problem along side this issue

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions