You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
It looks like something changed with filtering by an object expression in 1.3.6. In the example above no items in the list render until you type in the input bound to the fooFilter model. If you change back to angular 1.3.5 you'll see that the list of items render prior to any user interaction.
Workaround is to initialize fooFilter to empty string.
this is why i really wish we actually reviewed that big refactoring --- tests were passing, but it changed a bunch of things that people actually depended on, it was just too hard to spot the differences :\ we do need to change itb ack
The problem with filterFilter is that it's behaviour is largely undocumented (there are a lot of possible cases and only a small fraction covered in the docs), the comparator was mistreated (in many cases the expression object played the role of the comparator) and the test coverage left several cases out. (Besides, of course, not working as expected with "deep" objects (either as items or as expression objects).)
So, basically, there was no "official" way to determine how exactly it works and people depended on behaviours often disvovered by trial and error (and then sticking to what worked).
Thus, there was no reasonable way to determine exactly what would behave differently (afaik).
As I have said before, in order to fix something broken, you have to "break its broken-ness". And that is what it takes to fix filterFilter 😞
I know; we don't want breaking changes between minor versions (by which we actually mean "we don't want fixing broken behaviour that many people are likely to depend on").
(And I do understand this btw; I am just not thrilled about it.)
@caitp: Did you mean change the undefined behaviour back or revert the whole refactoring ?
@gkalpak: The only change that was needed was the one on line 199. I tried writing the following test for the other change you had and it already passed:
@caseyhoward: Indeed the first change wasn't necessary, because the case typeof expression === 'undefined' is handled by the default block in the switch statement. So, I guess we can leave it out :)
I'm not so sure if this is the right place, but I also found another strange behavior. It worked in 1.3.5 but it's broken in 1.3.6.
In this plunkr you'll see version 1.3.5, were you can select a type in the first select box. The options of the second selection are filtered based on the selection of the first one.
Strange for 1.3.6 is, that there is the whole selection available for the second dropdown if nothing is selected, but as soon as you select a type the second list is empty.
Activity
fix(filterFilter): Fix filtering using an object expression when the …
fix(filterFilter): Fix filtering using an object expression when the …
gkalpak commentedon Dec 11, 2014
This had been brought up in #9757 (example #9757 (comment), #9757 (comment) and #9757 (comment)) and it was intentionally implemented like this.
Note that a better approach to filtering imo (and one that does work as expected even in 1.3.6) is: http://plnkr.co/edit/6FLGXYBk0WP7P47MegmG?p=preview
But, I can imagine some people wanting this to match pre 1.3.6 behaviour, right @caitp 😄
andrewlague commentedon Dec 11, 2014
The fact remains that this is a change of behavior in a minor release--perhaps this should be documented.
caitp commentedon Dec 11, 2014
this is why i really wish we actually reviewed that big refactoring --- tests were passing, but it changed a bunch of things that people actually depended on, it was just too hard to spot the differences :\ we do need to change itb ack
gkalpak commentedon Dec 11, 2014
There is already a PR for fixing this, so...
gkalpak commentedon Dec 11, 2014
The problem with filterFilter is that it's behaviour is largely undocumented (there are a lot of possible cases and only a small fraction covered in the docs), the comparator was mistreated (in many cases the expression object played the role of the comparator) and the test coverage left several cases out. (Besides, of course, not working as expected with "deep" objects (either as items or as expression objects).)
So, basically, there was no "official" way to determine how exactly it works and people depended on behaviours often disvovered by trial and error (and then sticking to what worked).
Thus, there was no reasonable way to determine exactly what would behave differently (afaik).
As I have said before, in order to fix something broken, you have to "break its broken-ness". And that is what it takes to fix filterFilter 😞
I know; we don't want breaking changes between minor versions (by which we actually mean "we don't want fixing broken behaviour that many people are likely to depend on").
(And I do understand this btw; I am just not thrilled about it.)
@caitp: Did you mean change the
undefinedbehaviour back or revert the whole refactoring ?caitp commentedon Dec 11, 2014
Change the
undefinedcase back --- it looks like a pretty small change based on the PR.Re: things not being tested, we should really have some test coverage reports happening :\ but it's hard since we have like 5 different test harnesses
fix(filterFilter): Fix filtering using an object expression when the …
fix(filterFilter): Fix filtering using an object expression when the …
fix(filterFilter): Fix filtering using an object expression when the …
caseyhoward commentedon Dec 12, 2014
@gkalpak: The only change that was needed was the one on line 199. I tried writing the following test for the other change you had and it already passed:
I also merged the tests into one "it" block and made the test for deep objects slightly more thorough.
fix(filterFilter): Fix filtering using an object expression when the …
gkalpak commentedon Dec 12, 2014
@caseyhoward: Indeed the first change wasn't necessary, because the case
typeof expression === 'undefined'is handled by thedefaultblock in the switch statement. So, I guess we can leave it out :)rapmue commentedon Dec 15, 2014
I'm not so sure if this is the right place, but I also found another strange behavior. It worked in 1.3.5 but it's broken in 1.3.6.
In this plunkr you'll see version 1.3.5, were you can select a type in the first select box. The options of the second selection are filtered based on the selection of the first one.
Strange for 1.3.6 is, that there is the whole selection available for the second dropdown if nothing is selected, but as soon as you select a type the second list is empty.
gkalpak commentedon Dec 15, 2014
@rapmue: This is because of a regression in 1.3.6 and will be fixed by #10408.
lgalfaso commentedon Dec 17, 2014
#10408 landed
cspeper commentedon Feb 10, 2015
@caitp @lgalfaso this issue was closed on Dec 17th, but is still reproducible in 1.3.8 and 1.3.12:
Can we please re-open?
pkozlowski-opensource commentedon Feb 11, 2015
@cspeper could you please open a new issue with a clear reproduce scenario using plunker or similar?
fix(filterFilter): Fix filtering using an object expression when the …
fix(filterFilter): Fix filtering using an object expression when the …
fix(filterFilter): Fix filtering using an object expression when the …
fix(filterFilter): Fix filtering using an object expression when the …