Skip to content

Commit 90bede3

Browse files
natagh23claude
andcommitted
fix(prompts): disable window-focus refetch on version-history query
The prior fix's intent comment claimed refetchOnWindowFocus was off, but never actually set it — the default true still refetched every loaded page on window focus, defeating the point of bounding refetch cost to actual version_count changes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 247d732 commit 90bede3

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

apps/opik-frontend/src/v2/pages/PromptPage/PromptTab/usePromptVersionHistory.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ export default function usePromptVersionHistory(
4242
},
4343
{
4444
enabled: !!prompt?.id,
45-
// No refetchInterval/refetchOnWindowFocus here: useInfiniteQuery
46-
// refetches every already-loaded page sequentially, and the Diff/Deploy
47-
// menus deliberately load every page for large prompts — polling or
48-
// refocus-refetching that unconditionally would multiply request volume
49-
// by however many pages got loaded that session. Instead, the cheap
50-
// `prompt` query below polls `version_count` and this list only
51-
// refetches (own mutations aside) when that actually changes.
45+
// No refetchInterval, and refetchOnWindowFocus explicitly off:
46+
// useInfiniteQuery refetches every already-loaded page sequentially on
47+
// either trigger, and the Diff/Deploy menus deliberately load every
48+
// page for large prompts — polling or refocus-refetching that
49+
// unconditionally would multiply request volume by however many pages
50+
// got loaded that session. Instead, the cheap `prompt` query below
51+
// polls `version_count` and this list only refetches (own mutations
52+
// aside) when that actually changes.
53+
refetchOnWindowFocus: false,
5254
},
5355
);
5456

0 commit comments

Comments
 (0)