Skip to content

Commit 8190e12

Browse files
committed
ref: Remove some usages of dropUndefinedKeys()
In some places this should not really be needed, so we can skip this.
1 parent 79a3384 commit 8190e12

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
SEMANTIC_ATTRIBUTE_SENTRY_OP,
77
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
88
browserPerformanceTimeOrigin,
9-
dropUndefinedKeys,
109
getActiveSpan,
1110
getCurrentScope,
1211
getRootSpan,
@@ -101,11 +100,11 @@ function _trackINP(): () => void {
101100
const routeName = spanToUse ? spanToJSON(spanToUse).description : getCurrentScope().getScopeData().transactionName;
102101

103102
const name = htmlTreeAsString(entry.target);
104-
const attributes: SpanAttributes = dropUndefinedKeys({
103+
const attributes: SpanAttributes = {
105104
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser.inp',
106105
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: `ui.interaction.${interactionType}`,
107106
[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: entry.duration,
108-
});
107+
};
109108

110109
const span = startStandaloneWebVitalSpan({
111110
name,

packages/core/src/checkin.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {
88
} from './types-hoist';
99
import { dsnToString } from './utils-hoist/dsn';
1010
import { createEnvelope } from './utils-hoist/envelope';
11-
import { dropUndefinedKeys } from './utils-hoist/object';
1211

1312
/**
1413
* Create envelope from check in item.
@@ -36,7 +35,7 @@ export function createCheckInEnvelope(
3635
}
3736

3837
if (dynamicSamplingContext) {
39-
headers.trace = dropUndefinedKeys(dynamicSamplingContext) as DynamicSamplingContext;
38+
headers.trace = dynamicSamplingContext as DynamicSamplingContext;
4039
}
4140

4241
const item = createCheckInEnvelopeItem(checkIn);

packages/core/src/feedback.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { getClient, getCurrentScope } from './currentScopes';
22
import type { EventHint, FeedbackEvent, SendFeedbackParams } from './types-hoist';
3-
import { dropUndefinedKeys } from './utils-hoist/object';
43

54
/**
65
* Send user feedback to Sentry.
@@ -14,14 +13,14 @@ export function captureFeedback(
1413

1514
const feedbackEvent: FeedbackEvent = {
1615
contexts: {
17-
feedback: dropUndefinedKeys({
16+
feedback: {
1817
contact_email: email,
1918
name,
2019
message,
2120
url,
2221
source,
2322
associated_event_id: associatedEventId,
24-
}),
23+
},
2524
},
2625
type: 'feedback',
2726
level: 'info',

packages/core/src/session.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { SerializedSession, Session, SessionContext, SessionStatus } from './types-hoist';
2-
import { dropUndefinedKeys, timestampInSeconds, uuid4 } from './utils-hoist';
2+
import { timestampInSeconds, uuid4 } from './utils-hoist';
33

44
/**
55
* Creates a new `Session` object by setting certain default parameters. If optional @param context
@@ -137,7 +137,7 @@ export function closeSession(session: Session, status?: Exclude<SessionStatus, '
137137
* @returns a JSON object of the passed session
138138
*/
139139
function sessionToJSON(session: Session): SerializedSession {
140-
return dropUndefinedKeys({
140+
return {
141141
sid: `${session.sid}`,
142142
init: session.init,
143143
// Make sure that sec is converted to ms for date constructor
@@ -154,5 +154,5 @@ function sessionToJSON(session: Session): SerializedSession {
154154
ip_address: session.ipAddress,
155155
user_agent: session.userAgent,
156156
},
157-
});
157+
};
158158
}

packages/core/src/tracing/dynamicSamplingContext.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function getDynamicSamplingContextFromClient(trace_id: string, client: Cl
4646
release: options.release,
4747
public_key,
4848
trace_id,
49-
}) as DynamicSamplingContext;
49+
}) satisfies DynamicSamplingContext;
5050

5151
client.emit('createDsc', dsc);
5252

packages/replay-internal/src/coreHandlers/util/networkUtils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { serializeFormData } from '@sentry-internal/browser-utils';
22
import type { NetworkMetaWarning } from '@sentry-internal/browser-utils';
3-
import { dropUndefinedKeys, stringMatchesSomePattern } from '@sentry/core';
3+
import { stringMatchesSomePattern } from '@sentry/core';
44

55
import { NETWORK_BODY_MAX_SIZE, WINDOW } from '../../constants';
66
import type {
@@ -98,12 +98,12 @@ export function makeNetworkReplayBreadcrumb(
9898
start: startTimestamp / 1000,
9999
end: endTimestamp / 1000,
100100
name: url,
101-
data: dropUndefinedKeys({
101+
data: {
102102
method,
103103
statusCode,
104104
request,
105105
response,
106-
}),
106+
},
107107
};
108108

109109
return result;

packages/sveltekit/src/client/browserTracingIntegration.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { navigating, page } from '$app/stores';
22
import type { Client, Integration, Span } from '@sentry/core';
3-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, dropUndefinedKeys } from '@sentry/core';
3+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
44
import {
55
WINDOW,
66
browserTracingIntegration as originalBrowserTracingIntegration,
@@ -113,15 +113,15 @@ function _instrumentNavigations(client: Client): void {
113113
routingSpan.end();
114114
}
115115

116-
const navigationInfo = dropUndefinedKeys({
116+
const navigationInfo = {
117117
// `navigation.type` denotes the origin of the navigation. e.g.:
118118
// - link (clicking on a link)
119119
// - goto (programmatic via goto() or redirect())
120120
// - popstate (back/forward navigation)
121121
'sentry.sveltekit.navigation.type': navigation.type,
122122
'sentry.sveltekit.navigation.from': parameterizedRouteOrigin || undefined,
123123
'sentry.sveltekit.navigation.to': parameterizedRouteDestination || undefined,
124-
});
124+
};
125125

126126
startBrowserTracingNavigationSpan(client, {
127127
name: parameterizedRouteDestination || rawRouteDestination || 'unknown',

0 commit comments

Comments
 (0)