Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #506 impossible to filter in null values #507

Merged
merged 1 commit into from
Jun 20, 2016

Conversation

jfremy
Copy link
Contributor

@jfremy jfremy commented Jun 15, 2016

The fix for #427 (#428) is too aggressive in the sense that it prevents altogether to filter in a value of null.
Whatever the input in the filter input, it's impossible to include the line (it returns false systematically to the filter function on a null value)

I'd like to suggest a different fix. Instead of returning false, we set targetVal to the empty string in case the value is null or undefined. I believe this makes sense since the input from the user will be mostly text based (we could imagine custom filters for which it's not true) but in most cases it is. So assuming that having a value of null or undefined maps to an empty string seems sensible.

With that change, it becomes possible to filter in null values using the regex filter for instance and specifying a regex that only allows an empty string.

The fix for AllenFang#427 (AllenFang#428) is too aggressive in the sense that it prevents altogether to filter in a value of null.
Whatever the input in the filter input, it's impossible to include the line (it returns false systematically to the filter function on a null value)

I'd like to suggest a different fix. Instead of returning false, we set targetVal to the empty string in case the value is null or undefined. I believe this makes sense since the input from the user will be mostly text based (we could imagine custom filters for which it's not true) but in most cases it is. So assuming that having a value of null or undefined maps to an empty string seems sensible.

With that change, it becomes possible to filter in null values using the regex filter for instance and specifying a regex that only allows an empty string.
@AllenFang
Copy link
Owner

AllenFang commented Jun 15, 2016

@jfremy, I think it's good for fixing this issues :)

Thanks 👍

@AllenFang AllenFang merged commit 8a90468 into AllenFang:master Jun 20, 2016
@AllenFang
Copy link
Owner

@jfremy, released on v2.3.6. Thanks your contributions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants