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

ngOnChanges called twice #88

Closed
jerousseau opened this issue Nov 23, 2017 · 4 comments · Fixed by #128
Closed

ngOnChanges called twice #88

jerousseau opened this issue Nov 23, 2017 · 4 comments · Fixed by #128
Assignees
Labels

Comments

@jerousseau
Copy link
Contributor

Hi,

When we change the component on the fly, the ngOnChanges of the new component is called twice, first time with the inputs we have passed to the new component ( firstChange: true and no previousValue) and a second time with in previousValue the value of the old component.
Any idea to avoid this ?

Thanks

Plnkr example to reproduce : https://plnkr.co/edit/uM7FzOmI4wNPE4F8WtFR

@gund
Copy link
Owner

gund commented Apr 19, 2018

Hi @jerousseau,

Sorry for late response. Just got my hands on your plunkr.

I can confirm that this is a bug.
I will build a test case for it and then fix it pretty soon.

Thanks for building awesome example.

@gund gund self-assigned this Apr 19, 2018
@gund gund added the bug label Apr 19, 2018
gund added a commit that referenced this issue Apr 19, 2018
…hanged

So that OnChanges hook is called only once

closes #88
@gund gund closed this as completed in #128 Apr 19, 2018
@gund
Copy link
Owner

gund commented Apr 19, 2018

🎉 This issue has been resolved in version 2.1.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rocketkittens
Copy link

rocketkittens commented May 25, 2018

I am still experiencing this issue, perhaps only a change detection issue but not sure, using version 3.0.0

@gund
Copy link
Owner

gund commented May 30, 2018

@Alandroid can you please create a plunkr with repro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants