ng-dynamic-component: Upgrade to version 2.1.0 breaks
Hi,
I was updating the packages from my solution and when upgrading from 2.0.3 to 2.1.0 of your library, all of sudden my screen stopped working.
I had a dynamic form that receives the framework type at the creation of the module and I’m using your library to abstract the dynamic injection of the component
private _collectChangesFromDiffer(differ: any): SimpleChanges {
const changes = {} as SimpleChanges;
// It's breaking here! It seems like the differ is null or undefined, causing the loop to break.
differ.forEachItem((record: KeyValueChangeRecordAny) =>
changes[record.key] = new CustomSimpleChange(record.previousValue, record.currentValue, false));
differ.forEachAddedItem((record: KeyValueChangeRecordAny) =>
changes[record.key].previousValue = UNINITIALIZED);
return this._resolveChanges(changes);
}
before (v.2.0.3) :
if (inputsChanges) {
const isNotFirstChange = !!this._lastInputChanges;
this._lastInputChanges = this._collectChangesFromDiffer(inputsChanges);
if (isNotFirstChange) {
this.updateInputs();
}
}
Current:
if (inputsChanges) {
const isNotFirstChange = !!this._lastInputChanges;
this._updateInputChanges(inputsChanges);
if (isNotFirstChange) {
this.updateInputs();
}
}
Can you please have a look? It seems the caller of this function changed and something within the new routine is not happy. Possibly due to the fact the _collectChangesFromDiffer()
is called twice. One within the ngOnChanges and then on ngOnCheck.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 31 (13 by maintainers)
Commits related to this issue
- fix(directive): Check if inputs really changed when angular triggers change detection on them Because object structure might not change while the reference will closes #111 — committed to gund/ng-dynamic-component by deleted user 6 years ago
- fix(directive): Check if inputs really changed when angular triggers change detection on them Because object structure might not change while the reference will closes #111 — committed to gund/ng-dynamic-component by deleted user 6 years ago
@gund , @minuz , sorry guys but I think I might have reported a false issue. Inspired by your questions I reverted my Angular+CLI migration, did it again but this time enforced version 2.0.3 on ng-dynamic-component. I can confirm that this works with:
I must have upgraded ng-dynamic-component by mistake when upgating my libs, because I had caret range applied to it: ^2.0.3
You can disregard my previous comments on this issue. Thanks for a brainstorm which helped me to recover from that.
I agree with @minuz. My application is broken as well with the new upgrade. Here is the error from my app
Note the _collectChangesFromDiffer present in the error and in @minuz.
Also, can we have a change-log please.
Cheers