Skip to content

Commit 52ec332

Browse files
fix: ensure log details refresh when selecting different logs
- Set staleTime to 0 for useLogDetail hook to always consider cached data stale - Add refetchOnMount: 'always' to ensure fresh data is fetched when a log is selected - Reduce prefetch staleTime to 5 seconds for better consistency This fixes the bug where users needed to hard refresh to see log details of a specific log. The issue was that cached/initial data from the list query wasn't being properly refreshed when selecting a log. Co-authored-by: Emir Karabeg <emir-karabeg@users.noreply.github.com>
1 parent 1b8d666 commit 52ec332

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/sim/hooks/queries/logs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ export function useLogDetail(logId: string | undefined, options?: UseLogDetailOp
165165
queryFn: () => fetchLogDetail(logId as string),
166166
enabled: Boolean(logId) && (options?.enabled ?? true),
167167
refetchInterval: options?.refetchInterval ?? false,
168-
staleTime: 30 * 1000,
168+
staleTime: 0,
169+
refetchOnMount: 'always',
169170
initialData: () => {
170171
if (!logId) return undefined
171172
const listQueries = queryClient.getQueriesData<{
@@ -190,7 +191,7 @@ export function prefetchLogDetail(queryClient: QueryClient, logId: string) {
190191
queryClient.prefetchQuery({
191192
queryKey: logKeys.detail(logId),
192193
queryFn: () => fetchLogDetail(logId),
193-
staleTime: 30 * 1000,
194+
staleTime: 5 * 1000,
194195
})
195196
}
196197

0 commit comments

Comments
 (0)