Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

atscott
Copy link
Contributor

@atscott atscott commented Mar 28, 2023

…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.

@atscott atscott added area: core Issues related to the framework runtime target: major This PR is targeted for the next major release labels Mar 28, 2023
@atscott atscott added this to the v16-candidates milestone Mar 28, 2023
@angular-robot angular-robot bot added the detected: breaking change PR contains a commit with a breaking change label Mar 28, 2023
…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`.
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a 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.

Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@atscott atscott added the action: merge The PR is ready for merge by the caretaker label Mar 28, 2023
@atscott atscott removed the request for review from alxhub March 28, 2023 19:24
@atscott
Copy link
Contributor Author

atscott commented Mar 28, 2023

This PR was merged into the repository by commit be23b7c.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime detected: breaking change PR contains a commit with a breaking change target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants