Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from "../../../../common/service/workflow-persist/workflow-persist.service";
import { NgbdModalAddProjectWorkflowComponent } from "../user-project/user-project-section/ngbd-modal-add-project-workflow/ngbd-modal-add-project-workflow.component";
import { NgbdModalRemoveProjectWorkflowComponent } from "../user-project/user-project-section/ngbd-modal-remove-project-workflow/ngbd-modal-remove-project-workflow.component";
import { DashboardEntry, UserInfo } from "../../../type/dashboard-entry";
import { DashboardEntry } from "../../../type/dashboard-entry";
import { UserService } from "../../../../common/service/user/user.service";
import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
import { NotificationService } from "../../../../common/service/notification/notification.service";
Expand All @@ -45,6 +45,7 @@ import { DashboardWorkflow } from "../../../type/dashboard-workflow.interface";
import { DownloadService } from "../../../service/user/download/download.service";
import { DASHBOARD_USER_WORKSPACE } from "../../../../app-routing.constant";
import { GuiConfigService } from "../../../../common/service/gui-config.service";
import { SearchResultItem } from "../../../type/search-result";

/**
* Saved-workflow-section component contains information and functionality
Expand Down Expand Up @@ -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"])
Copy link
Contributor

@kunwp1 kunwp1 Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your fix is an overkill. Your fix relies on Hub service for a new duplicated workflow which is adding an extra network call. For a workflow we just duplicated, frontend already knows a current user is the owner of the workflow. So I suggest you fix the place that decides the link (whether to open a workspace or a preview page).

);

this.searchResultsComponent.entries = [...newEntries, ...this.searchResultsComponent.entries];
} catch (err: unknown) {
Expand Down
Loading