fix: respect custom filterFn.autoRemove over default empty string check#6195
fix: respect custom filterFn.autoRemove over default empty string check#6195isaackaara wants to merge 1 commit intoTanStack:mainfrom
Conversation
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
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
When a custom
filterFnprovides anautoRemovefunction, its return value should be the sole authority on whether to remove the filter. Previously, the default checks (undefinedvalue, empty string) were OR'd with the customautoRemoveresult, making it impossible to filter for empty strings even whenautoRemoveexplicitly returnedfalse.Before:
After:
This is a non-breaking change for built-in filter functions since they already handle empty values via
testFalseyin their ownautoRemoveimplementations.Fixes #6101