Conversation
Added parameter to the sort function which is only be used for the sortDefault behaviour for the first call. To fix the problem that the pipe called twice
|
mmh not sure. This one was due to race conditions so it might change from setup to the other. Here you simply asking to bypass the asynchronous nature of the sort operation. Could work to fix part of the issues. |
| $timeout.cancel(promise); | ||
| } | ||
| if (throttle < 0) { | ||
| if (throttle < 0 || (defaultSortActive != undefined && defaultSortActive == true)) { |
There was a problem hiding this comment.
could simply be defaultSortActive === true
|
Do you mean rare conditon? Because it's not really rare it's always happening if you combine the pipe with stSortDefault. So i think to bypass the asynchronous nature for the initialization of the stSortDefault is a good deal. I understand that the test can't set a default sort but in this plunker and in my application it works just fine, so i dont understand why the test can't do it. The plunker is the pipe example from the documentation with these little changes. |
|
I meant race condition: meaning sometimes it happens, sometimes it does not depending whether the pagination is loaded faster than an other directive for example. Ok for bypassing the default asynchronous nature.
Well you will probably need to fix some tests as you changed somehow the behavior introducing a new one which is not taken into account in the tests, but I definitely can not merge safely a PR which breaks the build even if it "works" in a plunker: your plunker may not consider other cases the tests |
|
Okey, but i don't think this is a race condition because you can modify the delay. So it depend on your own configuration. If you don't set the delay like in both of the issues described the pipe will be called twice. Unfortunately I'm not yet familiar with automatic testing. So i think it's better to ask you here over my opinion. Maybe if these two errors can be eliminate the remaining failed test will be solved too? |
Added parameter to the sort function which is only be used for the sortDefault behaviour for the first call.
This is to fix the problem for #329 and #388 and stop the confusion that this issue created.
It worked for me but i think i'm missing something because it was too easy...
Any objection for this PR?