@@ -16,6 +16,11 @@ import { useVirtualizer } from '@tanstack/react-virtual';
1616import useRowWhere , { RowWhereResult } from '@/hooks/useRowWhere' ;
1717
1818import { useQueriedChartConfig } from './hooks/useChartConfig' ;
19+ import { useLogEventRows } from './hooks/useSessionLogEvents' ;
20+ import type {
21+ SessionEventOpen ,
22+ SessionLogEvents ,
23+ } from './utils/sessionLogEvents' ;
1924import {
2025 getSessionRowHttp ,
2126 SessionRow ,
@@ -28,7 +33,7 @@ import styles from '@styles/SessionSubpanelV2.module.scss';
2833
2934type SessionEvent = {
3035 id : string ;
31- row : SessionRow ; // original row object
36+ open : SessionEventOpen ;
3237 isError : boolean ;
3338 isSuccess : boolean ;
3439 eventSource : 'navigation' | 'chat' | 'network' | 'custom' | 'log' ;
@@ -96,6 +101,7 @@ const EventRow = ({
96101export const SessionEventList = ( {
97102 queriedConfig,
98103 aliasMap,
104+ logEvents,
99105 onClick,
100106 onTimeClick,
101107 focus,
@@ -105,6 +111,7 @@ export const SessionEventList = ({
105111} : {
106112 queriedConfig : ChartConfigWithOptDateRange ;
107113 aliasMap : Record < string , string > ;
114+ logEvents : SessionLogEvents ;
108115 // highlightedResultId: string | undefined;
109116 focus : { ts : number ; setBy : string } | undefined ;
110117 minTs : number ;
@@ -130,7 +137,7 @@ export const SessionEventList = ({
130137
131138 const getRowWhere = useRowWhere ( { meta : data ?. meta , aliasMap } ) ;
132139
133- const rows = React . useMemo ( ( ) => {
140+ const spanRows = React . useMemo ( ( ) => {
134141 return (
135142 events . map ( event => {
136143 const { timestamp, durationInMs } = event ;
@@ -167,7 +174,7 @@ export const SessionEventList = ({
167174
168175 return {
169176 id : event . id ,
170- row : event ,
177+ open : { kind : 'span' , row : event } ,
171178 isError,
172179 isSuccess,
173180 eventSource : isNavigation
@@ -216,6 +223,7 @@ export const SessionEventList = ({
216223 } ) ?? [ ]
217224 ) ;
218225 } , [ events , showRelativeTime , minTs , formatTime ] ) ;
226+ const rows = useLogEventRows ( spanRows , logEvents , showRelativeTime , minTs ) ;
219227
220228 const parentRef = React . useRef < HTMLDivElement > ( null ) ;
221229
@@ -244,7 +252,7 @@ export const SessionEventList = ({
244252 }
245253 } , [ currentEventIndex , eventsFollowPlayerPosition , rowVirtualizer ] ) ;
246254
247- if ( isLoading ) {
255+ if ( isLoading || ( logEvents . isLoading && spanRows . length === 0 ) ) {
248256 return (
249257 < Stack p = "sm" gap = "xs" >
250258 < Skeleton height = { 36 } />
@@ -285,7 +293,11 @@ export const SessionEventList = ({
285293 dataIndex = { virtualItem . index }
286294 isHighlighted = { currentEventIndex === virtualItem . index }
287295 ref = { rowVirtualizer . measureElement }
288- onClick = { ( ) => onClick ( getRowWhere ( row . row ) ) }
296+ onClick = { ( ) =>
297+ row . open . kind === 'span'
298+ ? onClick ( getRowWhere ( row . open . row ) )
299+ : logEvents . open ( row . open . event )
300+ }
289301 onTimeClick = { ( ) => onTimeClick ( row . timestamp . getTime ( ) ) }
290302 />
291303 </ div >
0 commit comments