Fix workflow edit page not loading (#848)

* fix workflow not loading

* don't add hash if editing

* remove controller
This commit is contained in:
sua yoo 2023-05-11 22:33:35 -07:00 committed by GitHub
parent 98d82184e6
commit f250293794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,8 +103,6 @@ export class WorkflowDetail extends LiteElement {
private isPanelHeaderVisible?: boolean;
// Use to cancel requests
private getWorkflowController: AbortController | null = null;
private getWorkflowPromise?: Promise<Workflow>;
private readonly jobTypeLabels: Record<JobType, string> = {
@ -173,6 +171,8 @@ export class WorkflowDetail extends LiteElement {
}
private getActivePanelFromHash = () => {
if (this.isEditing) return;
const hashValue = window.location.hash.slice(1);
if (SECTIONS.includes(hashValue as any)) {
this.activePanel = hashValue as Tab;
@ -265,13 +265,6 @@ export class WorkflowDetail extends LiteElement {
}
}
private cancelInProgressGetWorkflow() {
if (this.getWorkflowController) {
this.getWorkflowController.abort(ABORT_REASON_CANCLED);
this.getWorkflowController = null;
}
}
render() {
if (this.isEditing && this.isCrawler) {
return html`
@ -1196,15 +1189,10 @@ export class WorkflowDetail extends LiteElement {
}
private async getWorkflow(): Promise<Workflow> {
this.getWorkflowController = new AbortController();
const data: Workflow = await this.apiFetch(
`/orgs/${this.orgId}/crawlconfigs/${this.workflowId}`,
this.authState!,
{
signal: this.getWorkflowController.signal,
}
this.authState!
);
this.getWorkflowController = null;
return data;
}
@ -1254,7 +1242,6 @@ export class WorkflowDetail extends LiteElement {
private stopPoll() {
window.clearTimeout(this.timerId);
this.cancelInProgressGetWorkflow();
}
private async getCrawl(crawlId: Crawl["id"]): Promise<Crawl> {