Fix settings tab 500 and env config grouping in UI
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
let navToken = 0;
|
||||
let loadingTab = false;
|
||||
let pendingTabLoad = null;
|
||||
const tabPanes = new Map();
|
||||
const tabBooted = new Set();
|
||||
|
||||
@@ -221,6 +222,10 @@
|
||||
credentials: "same-origin",
|
||||
headers: { "X-Instance-Soft-Nav": "1" },
|
||||
});
|
||||
const ct = (r.headers.get("content-type") || "").toLowerCase();
|
||||
if (!ct.includes("application/json")) {
|
||||
throw new Error("加载失败(HTTP " + r.status + ")");
|
||||
}
|
||||
const j = await r.json();
|
||||
if (!j.ok || !j.html) throw new Error(j.msg || "加载失败");
|
||||
return j.html;
|
||||
@@ -325,7 +330,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (loadingTab) return;
|
||||
if (loadingTab) {
|
||||
pendingTabLoad = { tab: tab, opts: options };
|
||||
return;
|
||||
}
|
||||
const token = ++navToken;
|
||||
loadingTab = true;
|
||||
try {
|
||||
@@ -343,6 +351,11 @@
|
||||
}
|
||||
} finally {
|
||||
if (token === navToken) loadingTab = false;
|
||||
if (pendingTabLoad) {
|
||||
const pending = pendingTabLoad;
|
||||
pendingTabLoad = null;
|
||||
if (pending.tab !== tab) void loadTab(pending.tab, pending.opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
section.appendChild(title);
|
||||
const grid = document.createElement("div");
|
||||
grid.className = "display-prefs-checks";
|
||||
(group.keys || []).forEach((item) => {
|
||||
(group.items || []).forEach((item) => {
|
||||
const label = document.createElement("label");
|
||||
label.className = "chk-label";
|
||||
const cb = document.createElement("input");
|
||||
|
||||
Reference in New Issue
Block a user