From da4b1e1a8814b4a0aa18cb82eae289a23fe8a0db Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 18 Dec 2025 20:36:55 +0000 Subject: [PATCH] fix: Prevent duplicate API calls when reopening conversation panel When the conversation panel was closed and reopened, TanStack Query's useInfiniteQuery would refetch all cached pages, causing multiple API calls. This fix adds staleTime of 5 minutes to prevent unnecessary refetches when the data is still fresh. This is consistent with other hooks in the codebase that use the same staleTime value. Co-authored-by: openhands --- frontend/src/hooks/query/use-paginated-conversations.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/hooks/query/use-paginated-conversations.ts b/frontend/src/hooks/query/use-paginated-conversations.ts index 5dfb41390a..0c7336cafc 100644 --- a/frontend/src/hooks/query/use-paginated-conversations.ts +++ b/frontend/src/hooks/query/use-paginated-conversations.ts @@ -27,5 +27,6 @@ export const usePaginatedConversations = (limit: number = 20) => { enabled: !!userIsAuthenticated, getNextPageParam: (lastPage) => lastPage.next_page_id, initialPageParam: undefined as string | undefined, + staleTime: 1000 * 60 * 5, // 5 minutes - prevents unnecessary refetches when reopening panel }); };