Skip to content

Commit d788c70

Browse files
committed
chore(tracing): refactor
1 parent c2e870c commit d788c70

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/tracing/src/browser/request.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,16 @@ export function xhrCallback(
217217

218218
// check first if the request has finished and is tracked by an existing span which should now end
219219
if (handlerData.endTimestamp) {
220-
if (!handlerData.xhr.__sentry_xhr_span_id__) return;
220+
const spanId = handlerData.xhr.__sentry_xhr_span_id__;
221+
if (!spanId) return;
221222

222-
const span = spans[handlerData.xhr.__sentry_xhr_span_id__];
223+
const span = spans[spanId];
223224
if (span) {
224225
span.setHttpStatus(xhr.status_code);
225226
span.finish();
226227

227228
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
228-
delete spans[handlerData.xhr.__sentry_xhr_span_id__];
229+
delete spans[spanId];
229230
}
230231
return;
231232
}

0 commit comments

Comments
 (0)