From 920e385a8f7e2ffa917b31be03d6d816f8569b60 Mon Sep 17 00:00:00 2001 From: Honey Date: Sun, 7 Jun 2026 19:49:29 +0200 Subject: [PATCH] fix: break static circular dep in notify.js that caused 'Failed to fetch' after ui split MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit notify.js statically imported navigate from views/views.js, creating a new circular chain: navigation.js → ui/ui.js → settings.js → downloads.js → notify.js → views/views.js → navigation.js. This chain did not exist in the old monolithic ui.js and caused module initialisation failures in some browsers. Fix: make navigate a lazy dynamic import inside _notifNavigate() body, which is the only call site. Also replace unnecessary dynamic import('../utils.js') calls with the already-statically-imported toast function. Co-Authored-By: Claude Sonnet 4.6 --- src/ui/notify.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/notify.js b/src/ui/notify.js index cc1677d..34b26b0 100644 --- a/src/ui/notify.js +++ b/src/ui/notify.js @@ -1,6 +1,4 @@ -import { esc } from '../utils.js'; -// Circular — safe (only used inside function bodies) -import { navigate } from '../views/views.js'; +import { esc, toast } from '../utils.js'; import { api } from '../api.js'; const _NOTIF_KEY = 'ns_notifications'; @@ -108,6 +106,8 @@ export async function _notifNavigate(notifId) { panel?.classList.remove('open'); overlay?.classList.remove('active'); + const { navigate } = await import('../views/views.js'); + if (n.navType === 'playlist' && n.navId) { navigate('playlist-detail', { id: n.navId, name: n.navName || n.title.replace(/^Playlist:\s*/, '') }); return; @@ -130,7 +130,7 @@ export async function _notifNavigate(notifId) { } } catch {} } - import('../utils.js').then(m => m.toast('Album nicht gefunden — Library-Scan nötig?')); + toast('Album nicht gefunden — Library-Scan nötig?'); return; } @@ -141,6 +141,6 @@ export async function _notifNavigate(notifId) { const match = artists.find(a => norm(a.name) === norm(n.navArtist)) || artists[0]; if (match) { navigate('artist-detail', { id: match.id, name: match.name }); return; } } catch {} - import('../utils.js').then(m => m.toast('Künstler nicht gefunden — Library-Scan nötig?')); + toast('Künstler nicht gefunden — Library-Scan nötig?'); } }