- no need for a separate effect since we can use the existing one - no need to cancel the similar artists query upon entering, since the unregister callback already does it
31 lines
976 B
TypeScript
31 lines
976 B
TypeScript
import { createFileRoute } from '@tanstack/react-router';
|
|
import { useLayoutEffect } from 'react';
|
|
|
|
import { useShellBridge } from '@/platform/shell/route-controllers';
|
|
|
|
export const Route = createFileRoute('/artist-detail/$source/$id')({
|
|
component: ArtistDetailPage,
|
|
});
|
|
|
|
// Thin legacy handoff: TanStack owns the URL shape here, but the vanilla JS
|
|
// artist-detail page still renders the actual experience for now. The route
|
|
// owns cancellation so similar-artist loading stops when this page changes.
|
|
function ArtistDetailPage() {
|
|
const bridge = useShellBridge();
|
|
const { source, id } = Route.useParams();
|
|
|
|
useLayoutEffect(() => {
|
|
if (!bridge) return;
|
|
|
|
const normalizedSource = source.toLowerCase() === 'library' ? null : source.toLowerCase();
|
|
bridge.navigateToArtistDetail(id, '', normalizedSource, {
|
|
skipRouteChange: true,
|
|
});
|
|
|
|
return () => {
|
|
bridge.cancelSimilarArtistsLoad();
|
|
};
|
|
}, [bridge, id, source]);
|
|
|
|
return null;
|
|
}
|