[arvados] updated: 2.7.0-6091-gffbd16ffad
git repository hosting
git at public.arvados.org
Tue Mar 19 17:26:25 UTC 2024
Summary of changes:
.../side-panel-tree/side-panel-tree-actions.ts | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
via ffbd16ffadb228c7eca488a65082344e78a9dc78 (commit)
from 9548790f004624cc6a143bb8cf9267e2fe7cbada (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit ffbd16ffadb228c7eca488a65082344e78a9dc78
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Tue Mar 19 13:26:20 2024 -0400
21357: moved resource fetches into a single await Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts b/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts
index b03ed8956e..c522139978 100644
--- a/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts
+++ b/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts
@@ -164,22 +164,25 @@ export const loadFavoritesTree = () => async (dispatch: Dispatch, getState: () =
const setFaves = async(links: LinkResource[], dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const uuids = links.map(it => it.headUuid);
- const groupItems: any = await services.groupsService.list({
+ const groupItems: Promise<any> = services.groupsService.list({
filters: new FilterBuilder()
.addIn("uuid", uuids)
.getFilters()
});
- const collectionItems: any = await services.collectionService.list({
+ const collectionItems: Promise<any> = services.collectionService.list({
filters: new FilterBuilder()
.addIn("uuid", uuids)
.getFilters()
});
- const processItems: any = await services.containerRequestService.list({
+ const processItems: Promise<any> = services.containerRequestService.list({
filters: new FilterBuilder()
.addIn("uuid", uuids)
.getFilters()
});
- const responseItems = groupItems.items.concat(collectionItems.items).concat(processItems.items);
+
+ const resolvedItems = await Promise.all([groupItems, collectionItems, processItems]);
+
+ const responseItems = resolvedItems.reduce((acc, response) => acc.concat(response.items), []);
//setting resources here so they won't be re-fetched in validation step
dispatch(resourcesActions.SET_RESOURCES(responseItems));
@@ -217,26 +220,28 @@ export const loadPublicFavoritesTree = () => async (dispatch: Dispatch, getState
const { items } = await services.linkService.list(params);
const uuids = items.map(it => it.headUuid);
- const groupItems: any = await services.groupsService.list({
+ const groupItems: Promise<any> = services.groupsService.list({
filters: new FilterBuilder()
.addIn("uuid", uuids)
.addIsA("uuid", typeFilters)
.getFilters()
});
- const collectionItems: any = await services.collectionService.list({
+ const collectionItems: Promise<any> = services.collectionService.list({
filters: new FilterBuilder()
.addIn("uuid", uuids)
.addIsA("uuid", typeFilters)
.getFilters()
});
- const processItems: any = await services.containerRequestService.list({
+ const processItems: Promise<any> = services.containerRequestService.list({
filters: new FilterBuilder()
.addIn("uuid", uuids)
.addIsA("uuid", typeFilters)
.getFilters()
});
- const responseItems = groupItems.items.concat(collectionItems.items).concat(processItems.items);
+ const resolvedItems = await Promise.all([groupItems, collectionItems, processItems]);
+
+ const responseItems = resolvedItems.reduce((acc, response) => acc.concat(response.items), []);
const filteredItems = items.filter(item => responseItems.some(responseItem => responseItem.uuid === item.headUuid));
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list