From ec7e97e1dec25172f68b8b24b9e5fcf687c53ca9 Mon Sep 17 00:00:00 2001 From: Athou Date: Thu, 4 Jul 2024 07:19:16 +0200 Subject: [PATCH] abort current request if we're changing what we're going to display --- commafeed-client/src/pages/app/FeedEntriesPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commafeed-client/src/pages/app/FeedEntriesPage.tsx b/commafeed-client/src/pages/app/FeedEntriesPage.tsx index 2c3cb92a4..1981c4daf 100644 --- a/commafeed-client/src/pages/app/FeedEntriesPage.tsx +++ b/commafeed-client/src/pages/app/FeedEntriesPage.tsx @@ -64,7 +64,7 @@ export function FeedEntriesPage(props: FeedEntriesPageProps) { // biome-ignore lint/correctness/useExhaustiveDependencies: we subscribe to state.timestamp because we want to reload entries even if the props are the same useEffect(() => { - dispatch( + const promise = dispatch( loadEntries({ source: { type: props.sourceType, @@ -73,6 +73,7 @@ export function FeedEntriesPage(props: FeedEntriesPageProps) { clearSearch: true, }) ) + return () => promise.abort() }, [dispatch, props.sourceType, id, location.state?.timestamp]) const noSubscriptions = rootCategory && flattenCategoryTree(rootCategory).every(c => c.feeds.length === 0)