Skip to content

[v8] Filter not working if accessorFn returns null for any row #4245

Description

@marceloverdijk

Describe the bug

Filtering a column defines like:

{
        id: 'name',
        header: 'Name',
        accessorKey: 'name',
}

works, even if that column has null values.

Now when doing

{
        id: 'name',
        header: 'Name',
        accessorFn: (row) => row.name !== 'ignore' ? row.name : null,
}

in this case filtering does not work anymore at all.
So even not for the rows returning a value.

I can use this workaround:

{
        id: 'name',
        header: 'Name',
        accessorFn: (row) => row.name !== 'ignore' ? row.name : '',
}

but this should not be needed I would say.

Your minimal, reproducible example

Steps to reproduce

See above.

Expected behavior

Rows with actual value to be filtered succesfully.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

macOS

react-table version

v8.5.1, v.8.5.2

TypeScript version

v4.7.4

Additional context

No response

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.

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