fix: Favicon race condition

Fixes a race condition due to the way the Tes logo has been implemented.
This commit is contained in:
Jaxon Lewis-Wilson
2026-01-27 14:31:33 +08:00
parent f05cd66e88
commit 8791038bcf
+21 -4
View File
@@ -50,13 +50,30 @@ async function init() {
documentLoadStyle.textContent = documentLoadCSS;
document.head.appendChild(documentLoadStyle);
const icons =
document.querySelectorAll<HTMLLinkElement>('link[rel*="icon"]');
function replaceIcons() {
document
.querySelectorAll<HTMLLinkElement>('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();