mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
Add debug marker and delay to dot-highlight script
Add data attribute to confirm script execution, and delay initialization to avoid React hydration clobbering changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5d1482ad64
commit
f6dff82852
1 changed files with 18 additions and 9 deletions
|
|
@ -101,16 +101,25 @@
|
|||
});
|
||||
}
|
||||
|
||||
// Run on initial load and on client-side navigation
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", highlightDotBlocks);
|
||||
} else {
|
||||
// Debug: mark that the script ran
|
||||
document.documentElement.setAttribute("data-dot-highlight", "loaded");
|
||||
|
||||
// Run after a short delay to let React hydration complete
|
||||
function init() {
|
||||
document.documentElement.setAttribute("data-dot-highlight", "init");
|
||||
highlightDotBlocks();
|
||||
// Re-run on SPA navigation (Mintlify uses Next.js)
|
||||
var observer = new MutationObserver(function () {
|
||||
highlightDotBlocks();
|
||||
});
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
}
|
||||
|
||||
// Re-run on SPA navigation (Mintlify uses Next.js)
|
||||
var observer = new MutationObserver(function () {
|
||||
highlightDotBlocks();
|
||||
});
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
setTimeout(init, 100);
|
||||
});
|
||||
} else {
|
||||
setTimeout(init, 100);
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue