({ className, layoutVariant = 'stacked-soft' }: EventInspectorProps)
| 118 | }; |
| 119 | |
| 120 | export function EventInspector({ className, layoutVariant = 'stacked-soft' }: EventInspectorProps) { |
| 121 | const [expandedEvents, setExpandedEvents] = useState<Set<string>>(new Set()); |
| 122 | const [fullMessageModal, setFullMessageModal] = useState<{ |
| 123 | open: boolean; |
| 124 | message: string; |
| 125 | title: string; |
| 126 | }>({ |
| 127 | open: false, |
| 128 | message: '', |
| 129 | title: '', |
| 130 | }); |
| 131 | const [diagnosticsDialogOpen, setDiagnosticsDialogOpen] = useState<string | null>(null); |
| 132 | const autoSelectionSignatureRef = useRef<string | null>(null); |
| 133 | const eventsListRef = useRef<HTMLUListElement>(null); |
| 134 | const autoScrollRef = useRef<boolean>(true); |
| 135 | |
| 136 | const { |
| 137 | selectedRunId, |
| 138 | events, |
| 139 | currentTime, |
| 140 | nodeStates, |
| 141 | dataFlows, |
| 142 | selectedNodeId, |
| 143 | selectedEventId, |
| 144 | selectEvent, |
| 145 | selectNode, |
| 146 | seek, |
| 147 | playbackMode, |
| 148 | isPlaying, |
| 149 | } = useExecutionTimelineStore(); |
| 150 | |
| 151 | const filteredEvents = useMemo(() => { |
| 152 | if (!selectedNodeId) { |
| 153 | return []; |
| 154 | } |
| 155 | return events.filter((event) => event.nodeId === selectedNodeId); |
| 156 | }, [events, selectedNodeId]); |
| 157 | |
| 158 | const displayEvents = filteredEvents.length > 0 ? filteredEvents : events; |
| 159 | |
| 160 | const displaySignature = useMemo(() => { |
| 161 | if (displayEvents.length === 0) { |
| 162 | return `${selectedRunId ?? 'none'}|${selectedNodeId ?? 'all'}|empty`; |
| 163 | } |
| 164 | const firstId = displayEvents[0].id; |
| 165 | const lastId = displayEvents[displayEvents.length - 1].id; |
| 166 | return `${selectedRunId ?? 'none'}|${selectedNodeId ?? 'all'}|${firstId}-${lastId}`; |
| 167 | }, [displayEvents, selectedRunId, selectedNodeId]); |
| 168 | |
| 169 | useEffect(() => { |
| 170 | if (displayEvents.length === 0) { |
| 171 | if (selectedEventId !== null) { |
| 172 | selectEvent(null); |
| 173 | } |
| 174 | autoSelectionSignatureRef.current = displaySignature; |
| 175 | return; |
| 176 | } |
| 177 |
nothing calls this directly
no test coverage detected