seongjinyoon commented on code in PR #4280:
URL: https://github.com/apache/texera/pull/4280#discussion_r2926667229
##########
frontend/src/app/dashboard/component/user/user-workflow/user-workflow.component.ts:
##########
@@ -289,27 +290,13 @@ export class UserWorkflowComponent implements
AfterViewInit {
);
}
- const userIds = new Set<number>();
- duplicatedWorkflowsInfo.forEach(workflow => {
- if (workflow.ownerId) {
- userIds.add(workflow.ownerId);
- }
- });
-
- let userIdToInfoMap: { [key: number]: UserInfo } = {};
- if (userIds.size > 0) {
- userIdToInfoMap = await
firstValueFrom(this.searchService.getUserInfo(Array.from(userIds)));
- }
-
- const newEntries = duplicatedWorkflowsInfo.map(duplicatedWorkflowInfo
=> {
- const entry = new DashboardEntry(duplicatedWorkflowInfo);
- const userInfo = userIdToInfoMap[duplicatedWorkflowInfo.ownerId];
- if (userInfo) {
- entry.setOwnerName(userInfo.userName);
- entry.setOwnerGoogleAvatar(userInfo.googleAvatar ?? "");
- }
- return entry;
- });
+ const searchResultItems: SearchResultItem[] =
duplicatedWorkflowsInfo.map(w => ({
+ resourceType: "workflow",
+ workflow: w,
+ }));
+ const newEntries = await firstValueFrom(
+
this.searchService.extendSearchResultsWithHubActivityInfo(searchResultItems,
this.isLogin, ["access"])
Review Comment:
I think my approach trades a negligible network cost for a better code
consistency. Can you explain why this might not be the optimal approach?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]