Skip to content

Commit

Permalink
feat: on push strategy for combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardmarcinco committed Dec 15, 2024
1 parent 8fad690 commit 8870430
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/combobox/combobox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {
AfterContentInit,
HostBinding,
TemplateRef,
OnDestroy
OnDestroy,
ChangeDetectionStrategy,
ChangeDetectorRef
} from "@angular/core";
import { AbstractDropdownView, DropdownService } from "carbon-components-angular/dropdown";
import { ListItem } from "carbon-components-angular/dropdown";
Expand Down Expand Up @@ -138,7 +140,6 @@ import { Observable } from "rxjs";
[placeholder]="placeholder"/>
@if (invalid) {
<svg
cdsIcon="warning--filled"
size="16"
class="cds--list-box__invalid-icon">
Expand Down Expand Up @@ -222,7 +223,8 @@ import { Observable } from "rxjs";
useExisting: ComboBox,
multi: true
}
]
],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnDestroy {
/**
Expand Down Expand Up @@ -500,7 +502,8 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
constructor(
protected elementRef: ElementRef,
protected dropdownService: DropdownService,
protected i18n: I18n
protected i18n: I18n,
protected cdr: ChangeDetectorRef
) {}

/**
Expand Down Expand Up @@ -743,6 +746,8 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
}

document.removeEventListener("click", this.outsideClick, true);

this.cdr.markForCheck();
}

/**
Expand All @@ -766,6 +771,8 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
this._dropUp = this._shouldDropUp();
}
}, 0);

this.cdr.markForCheck();
}

/**
Expand Down

0 comments on commit 8870430

Please sign in to comment.