-
-
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
[BUGFIX release] fix regression with computed filter/map/sort
#15855
Conversation
fixes #15843 |
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.
This regression was introduced in #15550 which changed both the reduceMacro
, multiArrayMacro
,and arrayMacro
( the one fixed in this PR) invocations to directly pass dependentKeys
in options (and therefore avoiding expand properties).
Can you add a test for the same regression that uses multiArrayMacro
(Ember.computed.uniq
for example) and reduceMacro
(Ember.computed.sum
for example) using brace expansion, and update those implementations also?
}, { dependentKeys: [ dependentKey ], readOnly: true }); | ||
}, { readOnly: true }); | ||
|
||
cp.property(dependentKey); |
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.
👍 the fix is good, but I wanted to comment here to explain why this is different.
The ComputedProperty
constructor does not run the provided dependent keys through expandProperties
(perhaps it should, but that is another issue altogether). So moving this out from the constructor options into cp.property
forces it to run expandProperties
.
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.
it is intentional that constructor argument does not run through expandProperties
to avoid extra work (so it expects expanded properties already) because I made dependent keys
passable through constructor :P actually
I think rest of computed properties are not affected by regression, because computed properties that use |
f56f1bb
to
c022509
Compare
Seems good to me. Can you add that assertion in a separate commit (as a |
function reduceMacro(dependentKey, callback, initialValue) { | ||
function reduceMacro(dependentKey, callback, initialValue, name) { | ||
assert( | ||
`Dependent key passed to Ember.computed.${name}() shouldn't contain brace expading pattern.`, |
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.
typo s/expading/expanding/
479a720
to
812394d
Compare
function multiArrayMacro(_dependentKeys, callback) { | ||
function multiArrayMacro(_dependentKeys, callback, name) { | ||
assert( | ||
`Dependents keys passed to Ember.computed.${name}() shouldn't contain brace expading pattern.`, |
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.
same as above
@@ -17,8 +17,12 @@ import compare from '../compare'; | |||
import { isArray } from '../utils'; | |||
import { A as emberA } from '../system/native_array'; | |||
|
|||
function reduceMacro(dependentKey, callback, initialValue, name) { | |||
assert( | |||
`Dependent key passed to Ember.computed.${name}() shouldn't contain brace expading pattern.`, |
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.
s/expading/expanding/
function multiArrayMacro(_dependentKeys, callback) { | ||
function multiArrayMacro(_dependentKeys, callback, name) { | ||
assert( | ||
`Dependent keys passed to Ember.computed.${name}() shouldn't contain brace expading pattern.`, |
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.
s/exading/expanding/
837adae
to
2b557dc
Compare
2b557dc
to
aabc86b
Compare
Hi, will this make it to 2.17? |
I believe so (and ultimately backported to 2.16 also)... |
filter/map/sort
would not expanditems.@each.{prop1,prop2}
therefore would not properly work