diff --git a/web_src/js/features/repo-issue-sidebar-combolist.ts b/web_src/js/features/repo-issue-sidebar-combolist.ts index f7a6f42051..1e950b80b6 100644 --- a/web_src/js/features/repo-issue-sidebar-combolist.ts +++ b/web_src/js/features/repo-issue-sidebar-combolist.ts @@ -2,7 +2,7 @@ import {fomanticQuery} from '../modules/fomantic/base.ts'; import {GET, POST} from '../modules/fetch.ts'; import {showErrorToast} from '../modules/toast.ts'; import {addDelegatedEventListener, queryElemChildren, queryElems, toggleElem} from '../utils/dom.ts'; -import {parseDom} from "../utils.ts"; +import {parseDom} from '../utils.ts'; export class IssueSidebarComboList { updateUrl: string; @@ -79,8 +79,7 @@ export class IssueSidebarComboList { } } - async sendRequestToBackend(changedValues: Array): Promise { - if (!changedValues.length) throw new Error('No changed values to update'); + async sendRequestToBackend(changedValues: Array): Promise { let lastResp: Response | null = null; if (this.updateAlgo === 'diff') { for (const value of this.initialValues) { @@ -100,10 +99,10 @@ export class IssueSidebarComboList { } async updateToBackend(changedValues: Array) { - if (!changedValues.length) return; this.elIssueSidebar.classList.add('is-loading'); try { const resp = await this.sendRequestToBackend(changedValues); + if (!resp) return; // no request sent, no need to reload if (!resp.ok) { showErrorToast(`Failed to update to backend: ${resp.statusText}`); return;