Skip to content

Commit fb0ae86

Browse files
waleedlatif1claude
andcommitted
fix(logs): sync active-tab callback before paint to keep keyboard guards aligned
Run the resolvedTab → onActiveTabChange propagation in useLayoutEffect so the parent's activeTabRef updates synchronously before the next paint. This closes the brief window where window keydown handlers in the logs page would still see activeTabRef.current === 'trace' and short-circuit arrow-key navigation immediately after switching to a log without a Trace tab. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 849ea64 commit fb0ae86

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/logs/components/log-details

apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
3+
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
44
import { formatDuration } from '@sim/utils/formatting'
55
import { ArrowDown, ArrowUp, Check, ChevronUp, Clipboard, Eye, Search, X } from 'lucide-react'
66
import { createPortal } from 'react-dom'
@@ -304,7 +304,7 @@ export function LogDetailsContent({ log, onActiveTabChange }: LogDetailsContentP
304304

305305
const resolvedTab: LogDetailsTab = activeTab === 'trace' && !showTraceTab ? 'overview' : activeTab
306306

307-
useEffect(() => {
307+
useLayoutEffect(() => {
308308
onActiveTabChange?.(resolvedTab)
309309
}, [resolvedTab, onActiveTabChange])
310310

0 commit comments

Comments
 (0)