Items with value="" are always filtered out, even if a custom filter function is provided which returns a non-zero value for that item. Expected behaviour would be to prioritize the custom filter function if one is provided, rather than always filtering these items out.
I believe the issue is with the score function here, which returns 0 if value is falsy:
function score(value: string) {
const filter = propsRef.current?.filter ?? defaultFilter
return value ? filter(value, state.current.search) : 0
}
Items with
value=""
are always filtered out, even if a custom filter function is provided which returns a non-zero value for that item. Expected behaviour would be to prioritize the custom filter function if one is provided, rather than always filtering these items out.I believe the issue is with the
score
function here, which returns0
ifvalue
is falsy: