Skip to content

Commit 0c3e9fb

Browse files
16.3 Hotfix: remove status entry when removing item (#20316)
* Add removeStatus method to repository manager Introduces a removeStatus method to UmbRepositoryItemsManager, allowing removal of a status by its unique identifier. * Remove item status on picker input removal Calls removeStatus on the item manager when an item is removed from the picker input selection to ensure its status is updated accordingly.
1 parent 062b185 commit 0c3e9fb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/picker-input/picker-input.context.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export class UmbPickerInputContext<
133133
#removeItem(unique: string) {
134134
const newSelection = this.getSelection().filter((value) => value !== unique);
135135
this.setSelection(newSelection);
136+
this.#itemManager.removeStatus(unique);
136137
this.getHostElement().dispatchEvent(new UmbChangeEvent());
137138
}
138139
}

src/Umbraco.Web.UI.Client/src/packages/core/repository/repository-items.manager.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ export class UmbRepositoryItemsManager<ItemType extends { unique: string }> exte
124124
return this.#items.asObservablePart((items) => items.find((item) => this.#getUnique(item) === unique));
125125
}
126126

127+
removeStatus(unique: string) {
128+
const newStatuses = this.#statuses.getValue().filter((status) => status.unique !== unique);
129+
this.#statuses.setValue(newStatuses);
130+
}
131+
127132
async getItemByUnique(unique: string) {
128133
// TODO: Make an observeOnce feature, to avoid this amount of code: [NL]
129134
const ctrl = this.observe(this.itemByUnique(unique), () => {}, null);

0 commit comments

Comments
 (0)