-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref: Remove some usages of dropUndefinedKeys()
#15781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ import type { | |
} from './types-hoist'; | ||
import { dsnToString } from './utils-hoist/dsn'; | ||
import { createEnvelope } from './utils-hoist/envelope'; | ||
import { dropUndefinedKeys } from './utils-hoist/object'; | ||
|
||
/** | ||
* Create envelope from check in item. | ||
|
@@ -36,7 +35,7 @@ export function createCheckInEnvelope( | |
} | ||
|
||
if (dynamicSamplingContext) { | ||
headers.trace = dropUndefinedKeys(dynamicSamplingContext) as DynamicSamplingContext; | ||
headers.trace = dynamicSamplingContext as DynamicSamplingContext; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should not care if there is something undefined in there, I believe? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should not! |
||
} | ||
|
||
const item = createCheckInEnvelopeItem(checkIn); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { getClient, getCurrentScope } from './currentScopes'; | ||
import type { EventHint, FeedbackEvent, SendFeedbackParams } from './types-hoist'; | ||
import { dropUndefinedKeys } from './utils-hoist/object'; | ||
|
||
/** | ||
* Send user feedback to Sentry. | ||
|
@@ -14,14 +13,14 @@ export function captureFeedback( | |
|
||
const feedbackEvent: FeedbackEvent = { | ||
contexts: { | ||
feedback: dropUndefinedKeys({ | ||
feedback: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should not care about undefined fields |
||
contact_email: email, | ||
name, | ||
message, | ||
url, | ||
source, | ||
associated_event_id: associatedEventId, | ||
}), | ||
}, | ||
}, | ||
type: 'feedback', | ||
level: 'info', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import type { SerializedSession, Session, SessionContext, SessionStatus } from './types-hoist'; | ||
import { dropUndefinedKeys, timestampInSeconds, uuid4 } from './utils-hoist'; | ||
import { timestampInSeconds, uuid4 } from './utils-hoist'; | ||
|
||
/** | ||
* 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, ' | |
* @returns a JSON object of the passed session | ||
*/ | ||
function sessionToJSON(session: Session): SerializedSession { | ||
return dropUndefinedKeys({ | ||
return { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is only called when we send the session, where this should be cleared out by |
||
sid: `${session.sid}`, | ||
init: session.init, | ||
// Make sure that sec is converted to ms for date constructor | ||
|
@@ -154,5 +154,5 @@ function sessionToJSON(session: Session): SerializedSession { | |
ip_address: session.ipAddress, | ||
user_agent: session.userAgent, | ||
}, | ||
}); | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { serializeFormData } from '@sentry-internal/browser-utils'; | ||
import type { NetworkMetaWarning } from '@sentry-internal/browser-utils'; | ||
import { dropUndefinedKeys, stringMatchesSomePattern } from '@sentry/core'; | ||
import { stringMatchesSomePattern } from '@sentry/core'; | ||
|
||
import { NETWORK_BODY_MAX_SIZE, WINDOW } from '../../constants'; | ||
import type { | ||
|
@@ -98,12 +98,12 @@ export function makeNetworkReplayBreadcrumb( | |
start: startTimestamp / 1000, | ||
end: endTimestamp / 1000, | ||
name: url, | ||
data: dropUndefinedKeys({ | ||
data: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be fine to contain undefined |
||
method, | ||
statusCode, | ||
request, | ||
response, | ||
}), | ||
}, | ||
}; | ||
|
||
return result; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { navigating, page } from '$app/stores'; | ||
import type { Client, Integration, Span } from '@sentry/core'; | ||
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, dropUndefinedKeys } from '@sentry/core'; | ||
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; | ||
import { | ||
WINDOW, | ||
browserTracingIntegration as originalBrowserTracingIntegration, | ||
|
@@ -113,15 +113,15 @@ function _instrumentNavigations(client: Client): void { | |
routingSpan.end(); | ||
} | ||
|
||
const navigationInfo = dropUndefinedKeys({ | ||
const navigationInfo = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. attributes can be undefined, that should not change anything. |
||
// `navigation.type` denotes the origin of the navigation. e.g.: | ||
// - link (clicking on a link) | ||
// - goto (programmatic via goto() or redirect()) | ||
// - popstate (back/forward navigation) | ||
'sentry.sveltekit.navigation.type': navigation.type, | ||
'sentry.sveltekit.navigation.from': parameterizedRouteOrigin || undefined, | ||
'sentry.sveltekit.navigation.to': parameterizedRouteDestination || undefined, | ||
}); | ||
}; | ||
|
||
startBrowserTracingNavigationSpan(client, { | ||
name: parameterizedRouteDestination || rawRouteDestination || 'unknown', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing possibly undefined here!