From 52ec3324744bfe5e4274bd9e1fd879d67250cac8 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 20 Feb 2026 22:28:12 +0000 Subject: [PATCH] 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 --- apps/sim/hooks/queries/logs.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/sim/hooks/queries/logs.ts b/apps/sim/hooks/queries/logs.ts index 3b8e71480cc..b3ff82202b6 100644 --- a/apps/sim/hooks/queries/logs.ts +++ b/apps/sim/hooks/queries/logs.ts @@ -165,7 +165,8 @@ export function useLogDetail(logId: string | undefined, options?: UseLogDetailOp queryFn: () => fetchLogDetail(logId as string), enabled: Boolean(logId) && (options?.enabled ?? true), refetchInterval: options?.refetchInterval ?? false, - staleTime: 30 * 1000, + staleTime: 0, + refetchOnMount: 'always', initialData: () => { if (!logId) return undefined const listQueries = queryClient.getQueriesData<{ @@ -190,7 +191,7 @@ export function prefetchLogDetail(queryClient: QueryClient, logId: string) { queryClient.prefetchQuery({ queryKey: logKeys.detail(logId), queryFn: () => fetchLogDetail(logId), - staleTime: 30 * 1000, + staleTime: 5 * 1000, }) }