From 8791038bcf759fc1d58f48c2f70601d3bc1850d3 Mon Sep 17 00:00:00 2001 From: Jaxon Lewis-Wilson Date: Tue, 27 Jan 2026 14:31:33 +0800 Subject: [PATCH 1/3] 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(); From 2c0f48877fba7cba152dbb23d0d1f28f02c762c6 Mon Sep 17 00:00:00 2001 From: Jaxon Lewis-Wilson Date: Tue, 27 Jan 2026 14:40:02 +0800 Subject: [PATCH 2/3] Appease codefactor --- src/SEQTA.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/SEQTA.ts b/src/SEQTA.ts index 70e05b5b..02fb29fe 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -50,16 +50,6 @@ async function init() { documentLoadStyle.textContent = documentLoadCSS; document.head.appendChild(documentLoadStyle); - function replaceIcons() { - document - .querySelectorAll('link[rel*="icon"]') - .forEach((link) => { - if (link.href !== icon48) { - link.href = icon48; - } - }); - } - replaceIcons(); const observer = new MutationObserver(() => { @@ -73,7 +63,6 @@ async function init() { attributeFilter: ["href", "rel"], }); - try { await initializeSettingsState(); @@ -102,3 +91,13 @@ async function init() { } } } + +function replaceIcons() { + document + .querySelectorAll('link[rel*="icon"]') + .forEach((link) => { + if (link.href !== icon48) { + link.href = icon48; + } + }); +} \ No newline at end of file From 2afe2364e4e8ad4cf9f5284e5f250b5c71bb3231 Mon Sep 17 00:00:00 2001 From: Jaxon Lewis-Wilson Date: Tue, 27 Jan 2026 16:09:15 +0800 Subject: [PATCH 3/3] Narrowed trigger criteria Instead of running every time document.head mutates, only run when mutation is an attribute change, target is a link, rel includes icon, and attribute is href. --- src/SEQTA.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/SEQTA.ts b/src/SEQTA.ts index 02fb29fe..70773ca1 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -52,17 +52,29 @@ async function init() { replaceIcons(); - const observer = new MutationObserver(() => { - replaceIcons(); + const observer = new MutationObserver((mutations) => { + for (const mutation of mutations) { + + if ( + mutation.type === "attributes" && + mutation.target instanceof HTMLLinkElement && + mutation.target.rel.includes("icon") && + mutation.attributeName === "href" + ) { + replaceIcons(); + return; + } + } }); observer.observe(document.head, { - childList: true, subtree: true, attributes: true, - attributeFilter: ["href", "rel"], + attributeFilter: ["href"], }); + + try { await initializeSettingsState();