From d31d2184cf45ea4899f748d7dda052314ccec135 Mon Sep 17 00:00:00 2001 From: HighImKevin Date: Sat, 14 Feb 2026 22:02:16 -0500 Subject: [PATCH] Use the apiHelper to cache breadcrumbs ancestors call --- scripts/breadcrumbs.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/breadcrumbs.js b/scripts/breadcrumbs.js index 2088317..4a9ff44 100644 --- a/scripts/breadcrumbs.js +++ b/scripts/breadcrumbs.js @@ -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) {