@topconsultnpm/sdkui-react 6.21.0-dev2.6 → 6.21.0-dev2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -142,27 +142,21 @@ export const getAttachmentInfo = (attachment, treeFs, draftLatestInfoMap, archiv
|
|
|
142
142
|
return { name, nameElement, tooltipContent, folderId, fileExt, draftExist, archivedDocumentsExist };
|
|
143
143
|
};
|
|
144
144
|
export const getDcmtTypeDescriptor = async (blogPosts) => {
|
|
145
|
-
// Create a Map to store tid as key and DcmtTypeDescriptor as value
|
|
146
145
|
const dcmtTypeMap = new Map();
|
|
147
|
-
// Collect unique
|
|
148
|
-
const
|
|
149
|
-
for (const
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
if (attachment.tid) {
|
|
153
|
-
uniqueTids.add(attachment.tid);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
146
|
+
// Collect unique tid-did pairs to avoid duplicate HTTP calls
|
|
147
|
+
const tidDidMap = new Map();
|
|
148
|
+
for (const { tid, did } of blogPosts.flatMap(bp => bp.attachments ?? [])) {
|
|
149
|
+
if (tid !== undefined && !tidDidMap.has(tid)) {
|
|
150
|
+
tidDidMap.set(tid, did);
|
|
156
151
|
}
|
|
157
152
|
}
|
|
158
|
-
// Fetch all descriptors in parallel
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
dcmtTypeMap.set(tid,
|
|
153
|
+
// Fetch all descriptors in parallel
|
|
154
|
+
await Promise.all(Array.from(tidDidMap.entries()).map(async ([tid, did]) => {
|
|
155
|
+
const descriptor = await DcmtTypeListCacheService.GetWithNotGrantedAsync(tid, did);
|
|
156
|
+
if (descriptor) {
|
|
157
|
+
dcmtTypeMap.set(tid, descriptor);
|
|
163
158
|
}
|
|
164
|
-
});
|
|
165
|
-
await Promise.all(promises);
|
|
159
|
+
}));
|
|
166
160
|
return dcmtTypeMap;
|
|
167
161
|
};
|
|
168
162
|
export const BlogPostHomeHeader = (header, classId, isSelected, searchText, headerClickCallback) => {
|