-
Notifications
You must be signed in to change notification settings - Fork 46
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
[#1749] Fixed activeFilterCount #1747
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I understand the code correctly:
- we do not need the count (it's either "active" or not the filter)
- if that's true, then the variable keeping the count is not needed as you can do one long or expression like
filterA.length > 0 || filterB.length >0
and so on which would declutter the function quite a bit - if we do need the count, then I'd declare the variable right before using it inside the function and also rename it to
activeFilterCount(): number
so it's much clearer what it does (the little details you know :)) - Whatever we need the count or not, I'm not sure I understand why sometimes we write
currentFilter?.
and others we docurrentFilter.
. As I see it, either it's always needed or never needed (maybe I'm not getting it though). If it's always needed I'd early returncurrrentFilter === undefined then false
(or 0 if we need the count)
Unfortunately we need to count as we have 3 states for isStateOpen (true, false and undefined) so currentFilter.length is 1 although we didn't set any filter when we select "ALL". DisplayName has kinda the same behaviour, if you never search it never appears in currentFilter, but after you searched and you removed it it appears as null or undefined in currentFilters. |
closes #1749