How can I avoid removing empty filters entirely? #6057
Unanswered
grant-progress
asked this question in
Q&A
Replies: 1 comment
-
FWIW, since I'm integrating this as the underlying table solution for a shared design system package, I just ended up bailing out of the built-in filtering and wrapping the tools with my own filtering state solution. Not particularly difficult to do and gives the adaptability I needed. I think that's perfectly fine (and it's nice that it's easy to bail out like this), but I do still think the filter removal behavior is a bit too opinionated as the internal behavior. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For my company's table UX, we want to make filters configurable outside the table itself via a menu system. This is similar to filter "pills" which can be added by selecting a column name to filter on. They are initialized with a default empty value, and the user can immediately add a more meaningful filter value in the menu. Removal of filters happens in this menu as well, by explicit action from the user.
I can't figure out how to achieve this with Tanstack Table's filter system, even after I overrode all built-in
filterFn
options with versions that have.autoRemove = () => false;
. So I dug into the source and found this. It appears that the library enforces removing filters if their value is empty regardless ofautoRemove
?I think this behavior is surprisingly opinionated for such an otherwise versatile tool. Can that logic be changed to utilize
??
instead, so that anyautoRemove
supplied value will be considered authoritative? Or better yet, canautoRemove
be globally configurable, so I don't have to override all the default filter functions at all?Marked as Q&A because hopefully there's a way to do this I didn't notice.
Beta Was this translation helpful? Give feedback.
All reactions