Skip to content

fix(table): filter predicate not called for falsy values - #19094

Merged
annieyw merged 1 commit into
angular:masterfrom
crisbeto:table-falsy-filter
Nov 7, 2020
Merged

fix(table): filter predicate not called for falsy values#19094
annieyw merged 1 commit into
angular:masterfrom
crisbeto:table-falsy-filter

Conversation

@crisbeto

Copy link
Copy Markdown
Member

We had a simple falsy check to determine whether to call the filter predicate. I'm guessing it was written this way so that if somebody were to clear a filter input, all items will be shown. This seems a bit too loose since it could catch things like 0 which technically aren't allowed due to the string type, but could still end up inside the data source if values are proxied in directly through the view.

Ideally we'd just call the predicate for all values and let it decide whether or not to filter, but I left in special cases for undefined, null and empty strings, because I expect a lot of apps to be broken if we were to change the behavior.

Fixes #19092.
Fixes #9967.

We had a simple falsy check to determine whether to call the filter predicate. I'm guessing it was written this way so that if somebody were to clear a filter input, all items will be shown. This seems a bit too loose since it could catch things like 0 which technically aren't allowed due to the `string` type, but could still end up inside the data source if values are proxied in directly through the view.

Ideally we'd just call the predicate for all values and let it decide whether or not to filter, but I left in special cases for undefined, null and empty strings, because I expect a lot of apps to be broken if we were to change the behavior.

Fixes angular#19092.
Fixes angular#9967.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Apr 17, 2020
@crisbeto
crisbeto requested a review from andrewseguin as a code owner April 17, 2020 15:33
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 17, 2020
@jelbourn

Copy link
Copy Markdown
Contributor

@andrewseguin PTAL

@andrewseguin andrewseguin added lgtm action: merge The PR is ready for merge by the caretaker labels Jun 15, 2020
@mmalerba mmalerba removed the lgtm label Jul 31, 2020
@annieyw
annieyw merged commit 6ec1551 into angular:master Nov 7, 2020
annieyw pushed a commit that referenced this pull request Nov 7, 2020
We had a simple falsy check to determine whether to call the filter predicate. I'm guessing it was written this way so that if somebody were to clear a filter input, all items will be shown. This seems a bit too loose since it could catch things like 0 which technically aren't allowed due to the `string` type, but could still end up inside the data source if values are proxied in directly through the view.

Ideally we'd just call the predicate for all values and let it decide whether or not to filter, but I left in special cases for undefined, null and empty strings, because I expect a lot of apps to be broken if we were to change the behavior.

Fixes #19092.
Fixes #9967.

(cherry picked from commit 6ec1551)
annieyw pushed a commit that referenced this pull request Nov 7, 2020
We had a simple falsy check to determine whether to call the filter predicate. I'm guessing it was written this way so that if somebody were to clear a filter input, all items will be shown. This seems a bit too loose since it could catch things like 0 which technically aren't allowed due to the `string` type, but could still end up inside the data source if values are proxied in directly through the view.

Ideally we'd just call the predicate for all values and let it decide whether or not to filter, but I left in special cases for undefined, null and empty strings, because I expect a lot of apps to be broken if we were to change the behavior.

Fixes #19092.
Fixes #9967.

(cherry picked from commit 6ec1551)
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release

Projects

None yet

6 participants