Skip to content

Commit

Permalink
fix(core): prevent unnecessary wrapper re-render (#2855)
Browse files Browse the repository at this point in the history
fix #2847
  • Loading branch information
aitboudad committed May 22, 2021
1 parent 4d688fe commit b26d64f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/src/lib/components/formly.field.ts
Expand Up @@ -100,6 +100,10 @@ export class FormlyField implements OnInit, OnChanges, DoCheck, AfterContentInit
this.attachComponentRef(ref, f);
wrapProperty<ViewContainerRef>(ref.instance, 'fieldComponent', ({ firstChange, previousValue, currentValue }) => {
if (currentValue) {
if (previousValue && previousValue['_lContainer'] === currentValue['_lContainer']) {
return;
}

const viewRef = previousValue ? previousValue.detach() : null;
if (viewRef && !viewRef.destroyed) {
currentValue.insert(viewRef);
Expand Down

0 comments on commit b26d64f

Please sign in to comment.