-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
fix(core): ComponentRef.setInput only sets input when not equal to pr… #49607
Conversation
…evious `ComponentRef.setInput` currently sets the input on the component regardless of the previous value the method was called with. This results in different behavior from bindings in templates, which only set inputs when the value differs in the `Object.is` check from its previous value. BREAKING CHANGE: ComponentRef.setInput will only set the input on the component if it is different from the previous value (based on `Object.is` equality). If code relies on the input always being set, it should be updated to copy objects or wrap primitives in order to ensure the input value differs from the previous call to `setInput`.
b3bee60
to
56f3a89
Compare
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.
Awesome to see this change. Left some nit comments, I think we should just use a map instead of a regular JS object.
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.
LGTM!
This PR was merged into the repository by commit be23b7c. |
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. |
…evious
ComponentRef.setInput
currently sets the input on the component regardless of the previous value the method was called with. This results in different behavior from bindings in templates, which only set inputs when the value differs in theObject.is
check from its previous value.BREAKING CHANGE: ComponentRef.setInput will only set the input on the component if it is different from the previous value (based on
Object.is
equality). If code relies on the input always being set, it should be updated to copy objects or wrap primitives in order to ensure the input value differs from the previous call tosetInput
.