@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 tids first to avoid duplicate HTTP calls
148
- const uniqueTids = new Set();
149
- for (const blogPost of blogPosts) {
150
- if (blogPost.attachments) {
151
- for (const attachment of blogPost.attachments) {
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 instead of sequentially
159
- const promises = Array.from(uniqueTids).map(async (tid) => {
160
- const dcmtTypeDescriptor = await DcmtTypeListCacheService.GetAsync(tid, true);
161
- if (dcmtTypeDescriptor) {
162
- dcmtTypeMap.set(tid, dcmtTypeDescriptor);
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev2.6",
3
+ "version": "6.21.0-dev2.7",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",