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:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user