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
This commit is contained in:
parent
0d683d87c0
commit
fa0ac4ced3
1 changed files with 1 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { createFileRoute } from '@tanstack/react-router';
|
import { createFileRoute } from '@tanstack/react-router';
|
||||||
import { useEffect, useLayoutEffect } from 'react';
|
import { useLayoutEffect } from 'react';
|
||||||
|
|
||||||
import { useShellBridge } from '@/platform/shell/route-controllers';
|
import { useShellBridge } from '@/platform/shell/route-controllers';
|
||||||
|
|
||||||
|
|
@ -17,15 +17,10 @@ function ArtistDetailPage() {
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!bridge) return;
|
if (!bridge) return;
|
||||||
|
|
||||||
bridge.cancelSimilarArtistsLoad();
|
|
||||||
const normalizedSource = source.toLowerCase() === 'library' ? null : source.toLowerCase();
|
const normalizedSource = source.toLowerCase() === 'library' ? null : source.toLowerCase();
|
||||||
bridge.navigateToArtistDetail(id, '', normalizedSource, {
|
bridge.navigateToArtistDetail(id, '', normalizedSource, {
|
||||||
skipRouteChange: true,
|
skipRouteChange: true,
|
||||||
});
|
});
|
||||||
}, [bridge, id, source]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!bridge) return;
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
bridge.cancelSimilarArtistsLoad();
|
bridge.cancelSimilarArtistsLoad();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue