soulsync/webui/src/routes/artist-detail/$source/$id.tsx
Antti Kettunen fa0ac4ced3
refactor(webui): simplify similar artists cleanup
- 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
2026-05-19 10:40:41 +03:00

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;
}