Skip to content

Commit df9b387

Browse files
authored
Repository Details Manager: Prevent making requests for empty arrays (#19731)
* fix: Prevent Repository Details Manager making requests for empty arrays Fixes #19604 * Reworked to pass the `uniques` through to the `#requestNewDetails()` method The unique values are included as a closure, persisting after the `#init` promise is resolved. Rather than call `getUniques()` to get an async'd value. * Updated with Copilot suggestions #19731 (comment)
1 parent 8cc6508 commit df9b387

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class UmbRepositoryDetailsManager<DetailType extends { unique: string }>
8888
this.removeUmbControllerByAlias('observeEntry_' + entry);
8989
});
9090

91-
this.#requestNewDetails();
91+
this.#requestNewDetails(uniques);
9292
},
9393
null,
9494
);
@@ -181,13 +181,13 @@ export class UmbRepositoryDetailsManager<DetailType extends { unique: string }>
181181
return this.#entries.asObservablePart((items) => items.find((item) => item.unique === unique));
182182
}
183183

184-
async #requestNewDetails(): Promise<void> {
184+
async #requestNewDetails(uniques?: Array<DetailType['unique']>): Promise<void> {
185+
if (!uniques?.length) return;
186+
185187
await this.#init;
186188
if (!this.repository) throw new Error('Repository is not initialized');
187189

188-
const requestedUniques = this.getUniques();
189-
190-
const newRequestedUniques = requestedUniques.filter((unique) => {
190+
const newRequestedUniques = uniques.filter((unique) => {
191191
const item = this.#statuses.getValue().find((status) => status.unique === unique);
192192
return !item;
193193
});

0 commit comments

Comments
 (0)