-
Notifications
You must be signed in to change notification settings - Fork 36
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
filterBy needs .@each when composed to see updates #407
filterBy needs .@each when composed to see updates #407
Comments
I verified the bug. Not sure on the fix yet. I think it's related to this line https://github.com/kellyselden/ember-macro-helpers/blob/v0.17.0/addon/flatten-keys.js#L18 not array-aware. |
Can confirm, hit this issue too today. My use case is alertConditions: DS.hasMany('alertCondition'),
alertConditionsFiltered: filterBy('alertConditions',raw('isDeleted'),false), // Filter out any to-be-deleted When I mark an alertCondition with Looks like there's some work towards solving this, but thought I'd add my comment in case its helpful. |
When I do But when I do I even tried I tried the I've been slowly converting my app to @kellyselden, which other macros may be affected by this? Will you accept a PR that adds checks for |
I'm not sure how wide-spread this issue is. I think expanding on the failing test in #149 to cover the cases I missed would be a good start. |
So I just noticed that above in my comment, I had a mistake, I should have been using Whether or not that is what my code was too at the time, I don't know since it was over 8 months ago. For what it's worth, I've just updated from 0.41 to 3.0.0 and tested //app/models/alert.js
alertConditions: DS.hasMany('alertCondition'),
alertConditionsFiltered: filterBy('alertConditions',raw('isDeleted'),raw(false)), // Filter out any to-be-deleted {{!-- After saving an alert with several conditions, then deleting a condition locally before saving again, marks the condition as 'isDeleted' --}}
{{!-- This template should now show the correct number each time a condition is deleted --}}
{{#if (gt alert.alertConditionsFiltered.length 0)}}
{{!-- previously, this number wouldn't go down --}}
Number of alert conditions: {{alert.alertConditionsFiltered.length}}
{{else}}
No conditions specified
{{/if}} But as I said, my use case / testing could have been wrong to begin with. If someone else could confirm this is fixed that would be great. |
This bug is now two years old! 🎂 @kellyselden Are you going to address this?
PS I would appreciate a statement regarding the addon's current status and future — in terms of maintenance, development and alignment with Ember's new course. |
It seems that without a
.@each.<keytofilterby>
the result will not update on changes to the key.I have a reproduction of the bug here: https://ember-twiddle.com/d6a67b62d1a193fbbdaa67fbd5092d14?openFiles=controllers.application.js%2C
I don't really know how to work with ember-macro-test-helpers so can't really build a failing test case. But hopefully this twiddle be enough.
The text was updated successfully, but these errors were encountered: