-
Notifications
You must be signed in to change notification settings - Fork 91
This library calls detect changes on every property change #322
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
Comments
While I agree that this isn't the Angular behavior, I do expect the test case to behave like this. |
In my use case I am using proxies to generate a dependency graph and checking if those dependencies are dirty with change detection hooks. Using this with
Replace |
I see, thanks for clarifying this @antischematic. |
I think automatic change detection should be kept while changing the implementation so it aligns better with real app behaviour.
These changes would require a bump to min Angular version >= 14.1. It should also be possible to get this working with a wrapper component using |
Thanks again for the input @antischematic .
I've tried
I do want to allow a more fine-grained control over the inputs/outputs properties, and the CD. |
@antischematic feel free to try out the beta version (13.0.0-beta.6). I will also update our app to this version later today/tomorrow to make sure there are no other breaking changes. |
@antischematic sorry to re-ping you but did you had the chance to test the beta release? |
@timdeschryver I've tried it out, here's my feedback:
function changeInput(values)
for (const [name, value] of Object.entries(values)) {
fixture.componentRef.setInput(name, value)
}
fixture.detectChanges() // call once after all inputs are set, this will also call ngOnChanges.
} ☝️ should be something like this
I pass
<counter [count]="0"></counter> <!-- ngOnChanges is called -->
<counter></counter> <!-- ngOnChanges is never called --> It also appears to be calling Other than that it looks good, though it's a bit confusing to have both |
@antischematic good catch about the ngOnChanges firing twice.
This version is available as |
@timdeschryver Thanks for that, my tests are now passing 13.0.0-beta-9 without any issues. |
This is released in v13 🥳 |
@all-contributors please add @antischematic for bug, ideas |
I've put up a pull request to add @antischematic! 🎉 |
Expected result:
count: 0
Actual result:
count: 3
This is not correct Angular behavior and breaks custom change detection strategies.
Proposal: Use
ComponentRef#setInput
to change component properties instead.The text was updated successfully, but these errors were encountered: