From 4a1eb6f8243f4a3a471c67a5260e9f7f487b9d9a Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 17 May 2025 19:53:56 +0200 Subject: [PATCH] Force re-render of virtuoso grid on filter changes Workaround for https://github.com/Suwayomi/Suwayomi-WebUI/issues/933 --- src/modules/global-search/screens/SearchAll.tsx | 2 ++ .../library/hooks/useGetVisibleLibraryMangas.ts | 2 ++ src/modules/library/screens/Library.tsx | 10 +++++++++- src/modules/library/screens/LibraryDuplicates.tsx | 2 ++ src/modules/source/screens/SourceMangas.tsx | 5 ++++- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/modules/global-search/screens/SearchAll.tsx b/src/modules/global-search/screens/SearchAll.tsx index 1b77baef..097d69ce 100644 --- a/src/modules/global-search/screens/SearchAll.tsx +++ b/src/modules/global-search/screens/SearchAll.tsx @@ -168,6 +168,8 @@ const SourceSearchPreview = React.memo( /> ) : ( { const [query] = useQueryParam('query', StringParam); const options = useGetCategoryMetadata(category ?? DEFAULT_CATEGORY); @@ -265,5 +266,6 @@ export const useGetVisibleLibraryMangas = refetchCategoryMangas().catch(defaultPromiseErrorHandler('Library::refetchCategoryMangas')), @@ -230,6 +234,8 @@ export function Library() { return ( <> {tab === activeTab && ( { {}} diff --git a/src/modules/source/screens/SourceMangas.tsx b/src/modules/source/screens/SourceMangas.tsx index fdc12197..02e39d5e 100644 --- a/src/modules/source/screens/SourceMangas.tsx +++ b/src/modules/source/screens/SourceMangas.tsx @@ -277,6 +277,8 @@ export function SourceMangas() { setLocationContentType(newContentType); }; + const gridKey = `${contentType}${JSON.stringify(filtersToApply)}${query}`; + const [ loadPage, { data, error, isLoading: loading, size: lastPageNum, abortRequest, filteredOutAllItemsOfFetchedPage }, @@ -453,7 +455,8 @@ export function SourceMangas() { {(isLoading || !error || (!!error && !!mangas.length)) && (