fix: break static circular dep in notify.js that caused 'Failed to fetch' after ui split
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
6391857fda
commit
920e385a8f
1 file changed
+5
-5
+5
-5
@@ -1,6 +1,4 @@
|
|||||||
import { esc } from '../utils.js';
|
import { esc, toast } from '../utils.js';
|
||||||
// Circular — safe (only used inside function bodies)
|
|
||||||
import { navigate } from '../views/views.js';
|
|
||||||
import { api } from '../api.js';
|
import { api } from '../api.js';
|
||||||
|
|
||||||
const _NOTIF_KEY = 'ns_notifications';
|
const _NOTIF_KEY = 'ns_notifications';
|
||||||
@@ -108,6 +106,8 @@ export async function _notifNavigate(notifId) {
|
|||||||
panel?.classList.remove('open');
|
panel?.classList.remove('open');
|
||||||
overlay?.classList.remove('active');
|
overlay?.classList.remove('active');
|
||||||
|
|
||||||
|
const { navigate } = await import('../views/views.js');
|
||||||
|
|
||||||
if (n.navType === 'playlist' && n.navId) {
|
if (n.navType === 'playlist' && n.navId) {
|
||||||
navigate('playlist-detail', { id: n.navId, name: n.navName || n.title.replace(/^Playlist:\s*/, '') });
|
navigate('playlist-detail', { id: n.navId, name: n.navName || n.title.replace(/^Playlist:\s*/, '') });
|
||||||
return;
|
return;
|
||||||
@@ -130,7 +130,7 @@ export async function _notifNavigate(notifId) {
|
|||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
import('../utils.js').then(m => m.toast('Album nicht gefunden — Library-Scan nötig?'));
|
toast('Album nicht gefunden — Library-Scan nötig?');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +141,6 @@ export async function _notifNavigate(notifId) {
|
|||||||
const match = artists.find(a => norm(a.name) === norm(n.navArtist)) || artists[0];
|
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; }
|
if (match) { navigate('artist-detail', { id: match.id, name: match.name }); return; }
|
||||||
} catch {}
|
} 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?');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user