@@ -48,12 +48,16 @@ export interface SpanProfileDetailsProps {
48
48
export function useSpanProfileDetails (
49
49
organization : Organization ,
50
50
project : Project | undefined ,
51
- event : Readonly < EventTransaction > ,
51
+ event : Readonly < EventTransaction | undefined > ,
52
52
span : SpanProfileDetailsProps [ 'span' ]
53
53
) {
54
54
const profileGroup = useProfileGroup ( ) ;
55
55
56
56
const processedEvent = useMemo ( ( ) => {
57
+ if ( ! event ) {
58
+ return null ;
59
+ }
60
+
57
61
const entries : EventTransaction [ 'entries' ] = [ ...( event . entries || [ ] ) ] ;
58
62
if ( profileGroup . images ) {
59
63
entries . push ( {
@@ -78,7 +82,7 @@ export function useSpanProfileDetails(
78
82
} , [ profileGroup . profiles , threadId ] ) ;
79
83
80
84
const nodes : CallTreeNode [ ] = useMemo ( ( ) => {
81
- if ( profile === null ) {
85
+ if ( profile === null || ! event ) {
82
86
return [ ] ;
83
87
}
84
88
@@ -133,7 +137,7 @@ export function useSpanProfileDetails(
133
137
} , [ nodes ] ) ;
134
138
135
139
const { frames, hasPrevious, hasNext} = useMemo ( ( ) => {
136
- if ( index >= maxNodes ) {
140
+ if ( index >= maxNodes || ! event ) {
137
141
return { frames : [ ] , hasPrevious : false , hasNext : false } ;
138
142
}
139
143
@@ -145,7 +149,7 @@ export function useSpanProfileDetails(
145
149
} , [ index , maxNodes , event , nodes ] ) ;
146
150
147
151
const profileTarget = useMemo ( ( ) => {
148
- if ( defined ( project ) ) {
152
+ if ( defined ( project ) && event ) {
149
153
const profileContext = event . contexts . profile ?? { } ;
150
154
151
155
if ( defined ( profileContext . profile_id ) ) {
@@ -214,7 +218,7 @@ export function SpanProfileDetails({
214
218
frames,
215
219
} = useSpanProfileDetails ( organization , project , event , span ) ;
216
220
217
- if ( ! defined ( profileTarget ) ) {
221
+ if ( ! defined ( profileTarget ) || ! processedEvent ) {
218
222
return null ;
219
223
}
220
224
0 commit comments