Skip to content

setColumnFilter(num) is broken when given a numeric value #5949

Open
@sheam

Description

@sheam

TanStack Table version

8.21.2

Framework/Library version

React 18.2.0

Describe the bug and the steps to reproduce it

When I set a numeric column filter, it immediately reverts to undefined, but it works if I set it to a string value.

const col = table.getColumn('colour');
const onClick = () => {
   col.setColumnFilter('purple');
};
useEffect(() => {
   console.log(col.getColumnFilter()); // prints undefined, undefined, purple
}, [col]);

But when I use a numeric column filter value it behaves differently.

const col = table.getColumn('colourId');
const onClick = () => {
   col.setColumnFilter(99);
};
useEffect(() => {
   console.log(col.getColumnFilter()); // prints undefined, undefined
}, [col]);

The sandbox shows the issue pretty clearly.

  • Click the "Red colour" filter button and view that the filter works.
  • Click the "Clear filters" button to reset the filters.
  • Click the "Red colourId" filter button and see that it does nothing. Essentially the filter set up in showRedByIdClicked() has not effect...

Let me know if there is more I can do to help.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/sandbox/kzxcl2

Screenshots or Videos (Optional)

No response

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

No, because I do not know how

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