-
Notifications
You must be signed in to change notification settings - Fork 91
rerender does recreate the component breaking ngOnChanges #360
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
I was so free to prototype a possible solution in #361. Feedback or just copy pasting it for a possible solution is very welcome :) |
@shaman-apprentice this is intended, https://testing-library.com/docs/angular-testing-library/api#change |
Thanks a lot for the fast reply and pointing me to the docs ❤️ To be honest, I haven't looked at the docs. I just assumed by my React knowledge... 👼 😞 In accordance to my React knowledge I find it natural to assume, that rerender does, what Although the docs are not clear to me as well:
What do you think about making the docs more clear, that the component will be destroyed and created from scratch? E.g.
|
@shaman-apprentice We're always open to contributions to make things better, including the docs 😊 I've choosen The proposal seems good to me. |
Cool :) I'll add this to my personal ToDo's (I'll probably have time to create a PR sometime between next week and the week after). Thanks again for your support and openness |
No problem, thank you! |
Bug
First of all of course thx for all the great open source work done! :)
Expected behavior
GIVEN a component which depends on previous value within
ngOnChanges
WHEN calling
rerender
with new input propertiesTHEN
ngOnChanges
gets called with previous and new current value.Actual behavior
The component gets recreated and changes within
ngOnChanges
are always initial changes.Minimal reproduction
The second expect in the test below will fail.
The two console logs will be:
The actual console logs in a small demo app are:
The text was updated successfully, but these errors were encountered: