mirror of
https://github.com/ranaldsgift/KefinTweaks.git
synced 2026-11-05 15:52:47 +01:00
Use the apiHelper to cache breadcrumbs ancestors call
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user