@@ -94,7 +94,9 @@ export default function Logs() {
9494 const [ previewLogId , setPreviewLogId ] = useState < string | null > ( null )
9595
9696 const activeLogId = isPreviewOpen ? previewLogId : selectedLogId
97- const activeLogQuery = useLogDetail ( activeLogId ?? undefined )
97+ const activeLogQuery = useLogDetail ( activeLogId ?? undefined , {
98+ refetchInterval : isLive ? 3000 : false ,
99+ } )
98100
99101 const logFilters = useMemo (
100102 ( ) => ( {
@@ -113,7 +115,7 @@ export default function Logs() {
113115
114116 const logsQuery = useLogsList ( workspaceId , logFilters , {
115117 enabled : Boolean ( workspaceId ) && isInitialized . current ,
116- refetchInterval : isLive ? 5000 : false ,
118+ refetchInterval : isLive ? 3000 : false ,
117119 } )
118120
119121 const dashboardFilters = useMemo (
@@ -132,7 +134,7 @@ export default function Logs() {
132134
133135 const dashboardStatsQuery = useDashboardStats ( workspaceId , dashboardFilters , {
134136 enabled : Boolean ( workspaceId ) && isInitialized . current ,
135- refetchInterval : isLive ? 5000 : false ,
137+ refetchInterval : isLive ? 3000 : false ,
136138 } )
137139
138140 const logs = useMemo ( ( ) => {
@@ -160,12 +162,6 @@ export default function Logs() {
160162 }
161163 } , [ debouncedSearchQuery , setStoreSearchQuery ] )
162164
163- useEffect ( ( ) => {
164- if ( ! isLive || ! selectedLogId ) return
165- const interval = setInterval ( ( ) => activeLogQuery . refetch ( ) , 5000 )
166- return ( ) => clearInterval ( interval )
167- } , [ isLive , selectedLogId , activeLogQuery ] )
168-
169165 const handleLogClick = useCallback (
170166 ( log : WorkflowLog ) => {
171167 if ( selectedLogId === log . id && isSidebarOpen ) {
@@ -279,8 +275,11 @@ export default function Logs() {
279275 setIsVisuallyRefreshing ( true )
280276 setTimeout ( ( ) => setIsVisuallyRefreshing ( false ) , REFRESH_SPINNER_DURATION_MS )
281277 logsQuery . refetch ( )
278+ if ( selectedLogId ) {
279+ activeLogQuery . refetch ( )
280+ }
282281 }
283- } , [ isLive , logsQuery ] )
282+ } , [ isLive , logsQuery , activeLogQuery , selectedLogId ] )
284283
285284 const prevIsFetchingRef = useRef ( logsQuery . isFetching )
286285 useEffect ( ( ) => {
0 commit comments