From 96b4983238ace451f65cc7cb72b6c8224cb2ee43 Mon Sep 17 00:00:00 2001 From: Arcadio Quintero Date: Thu, 18 Jul 2024 01:19:04 -0400 Subject: [PATCH] feat(edit-content) fix refresh issue when unselect all #28493 --- .../dot-category-field-category-list.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-category-field-category-list/dot-category-field-category-list.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-category-field-category-list/dot-category-field-category-list.component.ts index 5bac5361978d..5698c4c51763 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-category-field-category-list/dot-category-field-category-list.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-category-field-category-list/dot-category-field-category-list.component.ts @@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common'; import { AfterViewInit, ChangeDetectionStrategy, + ChangeDetectorRef, Component, computed, DestroyRef, @@ -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() {