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 <openhands@all-hands.dev>
This commit is contained in:
openhands 2025-12-18 20:36:55 +00:00
parent 7bd9a7f8b7
commit da4b1e1a88

View File

@ -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
});
};