File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
packages/tracing-internal/src/browser Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -543,12 +543,14 @@ function registerInpInteractionListener(
543543 const client = getClient ( ) ;
544544 // We need to get the replay, user, and activeTransaction from the current scope
545545 // so that we can associate replay id, profile id, and a user display to the span
546- const replay = client ?. getIntegrationByName ?.( 'Replay' ) as
547- | ( Integration & { getReplayId : ( ) => string } )
548- | undefined ;
546+ const replay =
547+ client !== undefined && client . getIntegrationByName !== undefined
548+ ? ( client . getIntegrationByName ( 'Replay' ) as Integration & { getReplayId : ( ) => string } )
549+ : undefined ;
549550 // eslint-disable-next-line deprecation/deprecation
550551 const activeTransaction = getActiveTransaction ( ) ;
551- const user = getCurrentScope ( ) ?. getUser ( ) ;
552+ const currentScope = getCurrentScope ( ) ;
553+ const user = currentScope !== undefined ? currentScope . getUser ( ) : undefined ;
552554 for ( const entry of entries ) {
553555 if ( isPerformanceEventTiming ( entry ) ) {
554556 const duration = entry . duration ;
Original file line number Diff line number Diff line change @@ -224,10 +224,10 @@ function _trackINP(interactionIdtoRouteNameMapping: InteractionRouteNameMapping)
224224 user : undefined ,
225225 replay : undefined ,
226226 } ;
227+ const userDisplay = user !== undefined ? user . email || user . id || user . ip_address : undefined ;
227228 // eslint-disable-next-line deprecation/deprecation
228- const userDisplay = user ?. email || user ?. id || user ?. ip_address ;
229- const profileId = activeTransaction ?. getProfileId ( ) ;
230- const replayId = replay ?. getReplayId ( ) ;
229+ const profileId = activeTransaction !== undefined ? activeTransaction . getProfileId ( ) : undefined ;
230+ const replayId = replay !== undefined ? replay . getReplayId ( ) : undefined ;
231231 const span = new Span ( {
232232 startTimestamp : startTime ,
233233 endTimestamp : startTime + duration ,
You can’t perform that action at this time.
0 commit comments