fix(ivy): ngOnChanges to receive SimpleChanges with private non minif…#22352
fix(ivy): ngOnChanges to receive SimpleChanges with private non minif…#22352marclaval wants to merge 2 commits intoangular:masterfrom
Conversation
There was a problem hiding this comment.
Not a "list" (may be fix the other API docs)
There was a problem hiding this comment.
IMO we should drop "private" everywhere, it sounds misleading.
There was a problem hiding this comment.
What about this terminology:
- alias = the name given in the decorator,
- property name = source code,
- minified name
There was a problem hiding this comment.
Agree that private is confusing. Interesting that I came to a similar conclusion but with alias flipped. e.g. public name is external facing, alias is internal-facing (if different).
There was a problem hiding this comment.
My reasoning is that there is the thing (the property in our case) and you can give it any alias with @Input(alias) whatever the alias we always refer to the thing.
There was a problem hiding this comment.
Looks like copy-pasted comment? Update to read onChanges?
There was a problem hiding this comment.
I think we could improve upon this name, esp since the property names of this will also be minified, which could be confusing. How about inputAliases?
There was a problem hiding this comment.
I think this test might be clearer if you show which parts would be minified. e.g.
inputs: {a: 'val1', b: 'publicName'},
inputsNonMinified: {b: 'val2'}
Same on line 1755
There was a problem hiding this comment.
Mention that these are private names or aliases to differentiate from inputs (same comment on line 40)?
There was a problem hiding this comment.
Same here, update to read onChanges?
There was a problem hiding this comment.
may be rename inputToAlias, inputToProperty, outputToAlias if you think the terminology proposed below makes sense ?
There was a problem hiding this comment.
I think that's backwards for inputs and outputs, no? The public names end up as the keys after inverting, so wouldn't it be aliasToInput and aliasToOutput?
There was a problem hiding this comment.
What about being more explicit by changing
${name}${this.val1}${this.val2} - ${Object.keys(simpleChanges).join(',')}
for
comp=${name} val1=${this.val1} val2=${this.val2} - changed=[${Object.getOwnPropertyNames(simpleChanges).join(',')] }
b0a14b4 to
2e383b6
Compare
|
Thanks for your reviews, I've integrated your comments. About the naming discussion, I've changed |
2e383b6 to
9854b09
Compare
There was a problem hiding this comment.
A dict is from something to something
vicb
left a comment
There was a problem hiding this comment.
Ok for me after my comments have been addressed.
Could you please open an issue for the alias naming ? Thanks.
…erty names as keys
9854b09 to
7e2c849
Compare
…ed property names as keys
7e2c849 to
8850381
Compare
kara
left a comment
There was a problem hiding this comment.
Looks good to me, apart from the naming. @marclaval created an issue to discuss naming with @mhevery returns here: #22383
|
@IgorMinar FYI, current But it's still possible to make it work by wrapping the |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |


…ied property names as keys
If my understanding is correct, with this code:
Then, upon changes, 'privateName' will be logged in the console, not 'publicName' and not the minified version of 'privateName'.
If this behaviour is to be kept, we'd need to generate some data structure to keep this information. This PR is implementing a quite naive solution for that.
On top of that, it adds tests for the
OnChangehook.