Avoid hub iframe overlay on embed shell tab switches.
Use in-shell content loading state instead of parent postMessage so tab changes do not trigger the full instance-frame loading mask. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -33,16 +33,9 @@
|
||||
return "";
|
||||
}
|
||||
|
||||
function notifyParentNavStart() {
|
||||
try {
|
||||
window.parent.postMessage({ type: "instance-frame-navigating" }, "*");
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
function notifyParentReady() {
|
||||
try {
|
||||
window.parent.postMessage({ type: "instance-frame-ready" }, "*");
|
||||
} catch (_) {}
|
||||
function setRootLoading(on) {
|
||||
const root = document.getElementById("embed-page-root");
|
||||
if (root) root.classList.toggle("is-embed-tab-loading", !!on);
|
||||
}
|
||||
|
||||
function setNavActive(tab) {
|
||||
@@ -99,7 +92,7 @@
|
||||
if (!tab || loadingTab) return;
|
||||
const token = ++navToken;
|
||||
loadingTab = true;
|
||||
notifyParentNavStart();
|
||||
setRootLoading(true);
|
||||
try {
|
||||
const qs = listWindowQueryString();
|
||||
const url = "/api/embed/page/" + encodeURIComponent(tab) + (qs ? "?" + qs : "");
|
||||
@@ -122,7 +115,7 @@
|
||||
} finally {
|
||||
if (token === navToken) {
|
||||
loadingTab = false;
|
||||
notifyParentReady();
|
||||
setRootLoading(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,7 +207,9 @@
|
||||
patchHardNavigations();
|
||||
bindNav();
|
||||
runPageInit(getTab());
|
||||
notifyParentReady();
|
||||
try {
|
||||
window.parent.postMessage({ type: "instance-frame-ready" }, "*");
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
global.InstanceEmbed = {
|
||||
|
||||
Reference in New Issue
Block a user