Skip to content

Commit 28f015e

Browse files
committed
refactor(ui/circuits): improve circuit query options and navigation handling
1 parent d4469ea commit 28f015e

File tree

4 files changed

+118
-179
lines changed

4 files changed

+118
-179
lines changed

ui-ssr/bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui-ssr/src/api/circuits.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,13 @@ export const circuitsQueryOptions = () =>
338338
queryOptions({
339339
queryKey: ['circuits'],
340340
queryFn: () => fetchCircuits(),
341-
refetchInterval: 2000,
341+
refetchInterval: (query) => {
342+
return query.state.data?.some(
343+
(c) => c.status === 'pending' || c.status === 'running',
344+
)
345+
? 2000
346+
: false
347+
},
342348
})
343349

344350
export const circuitStatusQueryOptions = (circuitId: string) =>

0 commit comments

Comments
 (0)