From 2fa069a4bcb1d3bd2b2bde15598e4cbbb50e84f9 Mon Sep 17 00:00:00 2001 From: Harshith Mohan <26010946+harshithmohan@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:42:47 +0530 Subject: [PATCH] Fix spinners in manual link page (#1122) --- .../UnrecognizedUtilityTabs/LinkFilesTab.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx b/src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx index 58f4f662..ba2e559d 100644 --- a/src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx +++ b/src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx @@ -157,7 +157,7 @@ const AnimeSelectPanel = ( const searchRows = useMemo(() => { const rows: React.ReactNode[] = []; - if (!seriesUpdating) { + if (!seriesUpdating && !searchQuery.isPending) { forEach(searchQuery.data, (data) => { rows.push(); }); @@ -169,7 +169,7 @@ const AnimeSelectPanel = ( ); } return rows; - }, [searchQuery.data, seriesUpdating, changeSelectedSeries]); + }, [seriesUpdating, searchQuery.isPending, searchQuery.data, changeSelectedSeries]); return (
@@ -229,6 +229,11 @@ function LinkFilesTab() { !!selectedSeries.ID && selectedSeries.Type !== SeriesTypeEnum.Unknown, ); + const selectedSeriesLoaded = useMemo(() => !!selectedSeries?.ID && !anidbEpisodesQuery.isFetching, [ + anidbEpisodesQuery.isFetching, + selectedSeries?.ID, + ]); + const showDataMap = useMemo(() => new Map( selectedRows @@ -665,14 +670,14 @@ function LinkFilesTab() {
Selected Files
- {selectedSeries?.ID && ( + {selectedSeriesLoaded && (
AniDB | 
)} - {selectedSeries.ID ? renderDynamicFileLinks() : renderStaticFileLinks()} + {selectedSeriesLoaded ? renderDynamicFileLinks() : renderStaticFileLinks()}
- {!selectedSeries?.ID && ( + {!selectedSeriesLoaded && ( )}