Content-Length: 411834 | pFad | http://github.com/getsentry/sentry-javascript/pull/15781

71 ref: Remove some usages of `dropUndefinedKeys()` by mydea · Pull Request #15781 · getsentry/sentry-javascript · GitHub
Skip to content
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

ref: Remove some usages of dropUndefinedKeys() #15781

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

mydea
Copy link
Member

@mydea mydea commented Mar 21, 2025

In some places this should not really be needed, so we can skip this.

@mydea mydea requested review from AbhiPrasad and chargome March 21, 2025 11:38
@mydea mydea self-assigned this Mar 21, 2025
@mydea mydea requested a review from a team as a code owner March 21, 2025 11:38
@@ -101,11 +100,11 @@ function _trackINP(): () => void {
const routeName = spanToUse ? spanToJSON(spanToUse).description : getCurrentScope().getScopeData().transactionName;

const name = htmlTreeAsString(entry.target);
const attributes: SpanAttributes = dropUndefinedKeys({
const attributes: SpanAttributes = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing possibly undefined here!

@@ -36,7 +35,7 @@ export function createCheckInEnvelope(
}

if (dynamicSamplingContext) {
headers.trace = dropUndefinedKeys(dynamicSamplingContext) as DynamicSamplingContext;
headers.trace = dynamicSamplingContext as DynamicSamplingContext;
Copy link
Member Author

Choose a reason for hiding this comment

The 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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should not!

@@ -14,14 +13,14 @@ export function captureFeedback(

const feedbackEvent: FeedbackEvent = {
contexts: {
feedback: dropUndefinedKeys({
feedback: {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not care about undefined fields

@@ -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 {
Copy link
Member Author

Choose a reason for hiding this comment

The 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 JSON.stringify() anyhow

@@ -98,12 +98,12 @@ export function makeNetworkReplayBreadcrumb(
start: startTimestamp / 1000,
end: endTimestamp / 1000,
name: url,
data: dropUndefinedKeys({
data: {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be fine to contain undefined

@@ -113,15 +113,15 @@ function _instrumentNavigations(client: Client): void {
routingSpan.end();
}

const navigationInfo = dropUndefinedKeys({
const navigationInfo = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attributes can be undefined, that should not change anything.

Copy link
Contributor

github-actions bot commented Mar 21, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.12 KB -0.02% -4 B 🔽
@sentry/browser - with treeshaking flags 22.91 KB - -
@sentry/browser (incl. Tracing) 36.46 KB -0.03% -10 B 🔽
@sentry/browser (incl. Tracing, Replay) 73.63 KB -0.02% -12 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 66.96 KB -0.02% -10 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 78.28 KB -0.02% -12 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 90.83 KB -0.01% -7 B 🔽
@sentry/browser (incl. Feedback) 40.25 KB -0.03% -9 B 🔽
@sentry/browser (incl. sendFeedback) 27.76 KB -0.03% -7 B 🔽
@sentry/browser (incl. FeedbackAsync) 32.55 KB -0.02% -4 B 🔽
@sentry/react 24.92 KB -0.05% -11 B 🔽
@sentry/react (incl. Tracing) 38.35 KB -0.05% -19 B 🔽
@sentry/vue 27.35 KB -0.03% -8 B 🔽
@sentry/vue (incl. Tracing) 38.15 KB -0.03% -9 B 🔽
@sentry/svelte 23.16 KB -0.02% -3 B 🔽
CDN Bundle 24.34 KB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing) 36.47 KB -0.01% -1 B 🔽
CDN Bundle (incl. Tracing, Replay) 71.46 KB -0.01% -6 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 76.66 KB -0.01% -5 B 🔽
CDN Bundle - uncompressed 71.17 KB -0.04% -24 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 108.21 KB -0.01% -9 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 219.47 KB -0.01% -12 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 232.04 KB -0.01% -12 B 🔽
@sentry/nextjs (client) 39.65 KB -0.02% -8 B 🔽
@sentry/sveltekit (client) 36.89 KB -0.03% -9 B 🔽
@sentry/node 142.61 KB -0.01% -5 B 🔽
@sentry/node - without tracing 96 KB -0.01% -1 B 🔽
@sentry/aws-serverless 120.36 KB -0.01% -6 B 🔽

View base workflow run

@@ -36,7 +35,7 @@ export function createCheckInEnvelope(
}

if (dynamicSamplingContext) {
headers.trace = dropUndefinedKeys(dynamicSamplingContext) as DynamicSamplingContext;
headers.trace = dynamicSamplingContext as DynamicSamplingContext;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should not!

mydea added 2 commits March 21, 2025 16:02
In some places this should not really be needed, so we can skip this.
@mydea mydea force-pushed the fn/remove-more-dropUndefinedKeys branch from c2c7934 to 13a0d88 Compare March 21, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/getsentry/sentry-javascript/pull/15781

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy