Restore hub iframe soft nav to cut blank tab switch gap.

Use fetch in-frame navigation with overlay and hover prefetch; show delayed hub loading spinner instead of hiding the iframe.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-24 00:32:03 +08:00
parent f63f8810e6
commit b18b2143b5
8 changed files with 216 additions and 15 deletions
+17 -2
View File
@@ -429,9 +429,24 @@
return j.url;
}
/** @type {number | null} */
let instanceFrameNavLoadingTimer = null;
function setInstanceFrameNavLoading(loading) {
const shell = document.getElementById("instance-frame-shell");
if (shell) shell.classList.toggle("is-instance-nav-loading", !!loading);
if (!shell) return;
if (instanceFrameNavLoadingTimer != null) {
clearTimeout(instanceFrameNavLoadingTimer);
instanceFrameNavLoadingTimer = null;
}
if (loading) {
instanceFrameNavLoadingTimer = window.setTimeout(() => {
shell.classList.add("is-instance-nav-loading");
instanceFrameNavLoadingTimer = null;
}, 140);
return;
}
shell.classList.remove("is-instance-nav-loading");
}
async function openInstance(exchangeId, nextPath, opts) {
@@ -3354,7 +3369,7 @@
if (!d || typeof d !== "object") return;
if (d.type === "instance-frame-navigating") {
setInstanceFrameNavLoading(true);
} else if (d.type === "instance-frame-ready" || d.type === "instance-theme-ready") {
} else if (d.type === "instance-frame-ready") {
setInstanceFrameNavLoading(false);
}
});