fix(webui): recover artist detail deep links in legacy startup
Parse /artist-detail/<source>/<id> during legacy initial navigation so Python/git-pull installs without a fresh React handoff bundle still call the existing artist detail loader instead of leaving the shell blank.
This commit is contained in:
parent
5335b79e36
commit
6b78ffeb0c
2 changed files with 22 additions and 0 deletions
|
|
@ -2171,6 +2171,20 @@ function buildArtistDetailPath(artistId, source = null) {
|
||||||
return '/artist-detail/' + encodeURIComponent(normalizedSource) + '/' + encodeURIComponent(String(artistId));
|
return '/artist-detail/' + encodeURIComponent(normalizedSource) + '/' + encodeURIComponent(String(artistId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseArtistDetailPath(pathname = window.location.pathname) {
|
||||||
|
const segs = String(pathname || '').split('/').filter(Boolean);
|
||||||
|
if (segs[0] !== 'artist-detail' || segs.length < 3) return null;
|
||||||
|
|
||||||
|
const source = decodeURIComponent(segs[1] || '');
|
||||||
|
const artistId = decodeURIComponent(segs.slice(2).join('/'));
|
||||||
|
if (!source || !artistId) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
artistId,
|
||||||
|
source: source.toLowerCase() === 'library' ? null : source,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// ===============================
|
// ===============================
|
||||||
// MOBILE NAVIGATION
|
// MOBILE NAVIGATION
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
|
||||||
|
|
@ -1175,6 +1175,14 @@ async function loadInitialData() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetPage === 'artist-detail') {
|
||||||
|
const artistRoute = typeof parseArtistDetailPath === 'function' ? parseArtistDetailPath() : null;
|
||||||
|
if (artistRoute && typeof navigateToArtistDetail === 'function') {
|
||||||
|
navigateToArtistDetail(artistRoute.artistId, '', artistRoute.source);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Always apply the target page to the legacy shell chrome.
|
// Always apply the target page to the legacy shell chrome.
|
||||||
const router = getWebRouter();
|
const router = getWebRouter();
|
||||||
const route = router?.routeManifest?.find((entry) => entry.pageId === targetPage);
|
const route = router?.routeManifest?.find((entry) => entry.pageId === targetPage);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue