Skip to content

Commit f09760e

Browse files
committed
fix(browser): Remove optional chaining in INP code
1 parent d5a332c commit f09760e

File tree

1 file changed

+7
-1
lines changed
  • packages/browser-utils/src/metrics

1 file changed

+7
-1
lines changed

packages/browser-utils/src/metrics/inp.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ function _trackINP(): () => void {
9393
const replayId = replay && replay.getReplayId();
9494

9595
const userDisplay = user !== undefined ? user.email || user.id || user.ip_address : undefined;
96-
const profileId = scope.getScopeData().contexts?.profile?.profile_id as string | undefined;
96+
let profileId = undefined;
97+
try {
98+
// @ts-expect-error skip optional chaining to save bundle size with try catch
99+
profileId = scope.getScopeData().contexts.profile.profile_id;
100+
} catch {
101+
// do nothing
102+
}
97103

98104
const name = htmlTreeAsString(entry.target);
99105
const attributes: SpanAttributes = dropUndefinedKeys({

0 commit comments

Comments
 (0)