Use the apiHelper to cache breadcrumbs ancestors call

This commit is contained in:
HighImKevin
2026-02-14 22:02:16 -05:00
parent bb1c2a25f7
commit d31d2184cf
+9 -1
View File
@@ -81,7 +81,15 @@
let queryParams = '';
if (item.ParentId) {
// Get the top parent item from the ancestors with a Type = CollectionFolder
const ancestors = await ApiClient.getAncestorItems(item.Id);
// Use apiHelper.getQuery rather than getAncestorItems so we can use the cached data
const ancestorsUrl = `${ApiClient.serverAddress()}/Items/${item.Id}/Ancestors`;
const queryResult = await window.apiHelper.getQuery(ancestorsUrl, { useCache: true });
let ancestors = queryResult.data;
if (!ancestors || !Array.isArray(ancestors)) {
ancestors = await queryResult.dataPromise;
}
const collectionFolder = ancestors.find(ancestor => ancestor.Type === 'CollectionFolder');
const userRootFolder = ancestors.find(ancestor => ancestor.Type === 'UserRootFolder');
if (collectionFolder) {