From 8791038bcf759fc1d58f48c2f70601d3bc1850d3 Mon Sep 17 00:00:00 2001 From: Jaxon Lewis-Wilson Date: Tue, 27 Jan 2026 14:31:33 +0800 Subject: [PATCH] fix: Favicon race condition Fixes a race condition due to the way the Tes logo has been implemented. --- src/SEQTA.ts | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/SEQTA.ts b/src/SEQTA.ts index 9d4dc8c7..70e05b5b 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -50,13 +50,30 @@ async function init() { documentLoadStyle.textContent = documentLoadCSS; document.head.appendChild(documentLoadStyle); - const icons = - document.querySelectorAll('link[rel*="icon"]'); + function replaceIcons() { + document + .querySelectorAll('link[rel*="icon"]') + .forEach((link) => { + if (link.href !== icon48) { + link.href = icon48; + } + }); + } - icons.forEach((link) => { - link.href = icon48; + replaceIcons(); + + const observer = new MutationObserver(() => { + replaceIcons(); }); + observer.observe(document.head, { + childList: true, + subtree: true, + attributes: true, + attributeFilter: ["href", "rel"], + }); + + try { await initializeSettingsState();