-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Ember.computed.filter replaces items in place when a property changes #4423
Comments
@tim-evans are you able to provide a reduced test case? |
@wagenet this seems to be more of a cause and affect thing using Ember Data and reduceComputed. When the It seems to me that there's no bugs in either implementation; there's just a side effect of how they work that causes this issue. tldr; no, I couldn't provide a reduced test case. |
This still seems like a bug me to me. If an item is in the array both before and after it probably shouldn't be removed in the middle. |
@hjdivad thoughts? |
@wagenet the problem is exactly as @tim-evans described. The issue is twofold:
Fixing #1 is doable I think. @stefanpenner IIRC we talked about this before; having attribute Fixing #2 is probably a good idea but a bit of work. We could make As an interim solution we could do something a bit hacky in |
I think a related issue occurs when a I.e. someone types something in an input field, and it immediately loses focus.
Step-by-step explanation of the issue: |
See #5268 |
I'm having the exact same problem as @sandstrom. Is there a work-around for this in a meantime? |
This sounds related to #9313 I have a very simple jsBin on that issue that demonstrates how a property change causes the affected item to be removed and then the entire array recomputed. |
@hjdivad, I'm very interested the second scenario you mentioned earlier. Could you give an example of this happening? Is @ahacking's JSBin an example of this scenario? I just want to make sure I understand how this would happen as it seems like something that could bite you in the ass. :P
|
I have a list of text fields bound to a
filter
, and we have a UX issue where when the field is auto-saved, the text field loses focus. I've tracked down the issue to reduceComputed properties. WhenflushProperties
is called, it removes the item, then adds the item back.This issue wasn't happening before I upgraded to 1.4.0. This might also be related to how quickly content gets flushed to the DOM. (The add and remove occur directly after each other- with the item in the same location. Should this affect the DOM?).
The text was updated successfully, but these errors were encountered: