Skip to content

Commit

Permalink
fix(core): only trigger style updates when value changes (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaerusKaru authored May 9, 2020
1 parent b05d51a commit a96ef13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/core/base/base2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export abstract class BaseDirective2 implements OnChanges, OnDestroy {
/** The most recently used styles for the builder */
protected mru: StyleDefinition = {};
protected destroySubject: Subject<void> = new Subject();
protected currentValue: any;

/** Access to host element's parent DOM node */
protected get parentElement(): HTMLElement | null {
Expand Down Expand Up @@ -148,6 +149,9 @@ export abstract class BaseDirective2 implements OnChanges, OnDestroy {
}

protected updateWithValue(input: string) {
this.addStyles(input);
if (this.currentValue !== input) {
this.addStyles(input);
this.currentValue = input;
}
}
}

0 comments on commit a96ef13

Please sign in to comment.