Skip to content

Commit

Permalink
feat(edit-content) fix refresh issue when unselect all #28493
Browse files Browse the repository at this point in the history
  • Loading branch information
oidacra committed Jul 18, 2024
1 parent 701be06 commit 96b4983
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common';
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
computed,
DestroyRef,
Expand Down Expand Up @@ -89,12 +90,15 @@ export class DotCategoryFieldCategoryListComponent implements AfterViewInit {
*/
itemsSelected: string[];

#cdr = inject(ChangeDetectorRef);

readonly #destroyRef = inject(DestroyRef);

readonly #effectRef = effect(() => {
// Todo: find a better way to update this
// Todo: change itemsSelected to use model when update Angular to >17.3
// Initial selected items from the contentlet
this.itemsSelected = this.selected();
this.#cdr.markForCheck(); // force refresh
});

ngAfterViewInit() {
Expand Down

0 comments on commit 96b4983

Please sign in to comment.