0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-04 05:45:23 +02:00

fix combolist

This commit is contained in:
wxiaoguang 2026-03-30 23:15:00 +08:00
parent ea3db23d82
commit eb9f4f1213

View File

@ -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<string>): Promise<Response> {
if (!changedValues.length) throw new Error('No changed values to update');
async sendRequestToBackend(changedValues: Array<string>): Promise<Response | null> {
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<string>) {
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;