Skip to content

Commit 3d34499

Browse files
jr-rkclaude
andcommitted
@
Fix: always unhide app when removing SSR anti-flicker overlay The overlay remover bailed out via `if (!el) return;` before unhiding `<ds-app>`, so if the overlay node went missing (browser extension, race, external script) the app stayed `visibility:hidden` forever -> blank page, plus the kept SSR styles leaked. Unhide the app and clean up the kept styles unconditionally, before checking for the overlay node. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> @
1 parent fa485f7 commit 3d34499

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

src/index.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,28 @@
103103
removing = true;
104104
window.__dspaceRemoveSsrOverlay = null;
105105

106-
var el = document.getElementById('__dspace_ssr_overlay');
107-
if (!el) return;
106+
// Always unhide the real <ds-app> and drop the kept SSR styles first, even if the
107+
// overlay node has gone missing (e.g. removed by an extension or another script).
108+
// A bare early return here would otherwise leave the app permanently hidden.
108109
app.removeAttribute('data-dspace-ssr-hidden');
109-
el.style.transition = 'opacity 150ms ease-out';
110-
el.style.opacity = '0';
111-
setTimeout(function () {
112-
if (el && el.parentNode) el.parentNode.removeChild(el);
110+
111+
var removeKeptStyles = function () {
113112
for (var i = 0; i < keptStyles.length; i++) {
114113
if (keptStyles[i].parentNode) keptStyles[i].parentNode.removeChild(keptStyles[i]);
115114
}
116115
keptStyles = [];
116+
};
117+
118+
var el = document.getElementById('__dspace_ssr_overlay');
119+
if (!el) {
120+
removeKeptStyles();
121+
return;
122+
}
123+
el.style.transition = 'opacity 150ms ease-out';
124+
el.style.opacity = '0';
125+
setTimeout(function () {
126+
if (el && el.parentNode) el.parentNode.removeChild(el);
127+
removeKeptStyles();
117128
}, 200);
118129
};
119130

0 commit comments

Comments
 (0)