Skip to content

ref(nitro, nuxt): inline == null checks for nullish detection - #22154

Merged
logaretm merged 1 commit into
developfrom
feat/consolidate-is-nullish
Jul 9, 2026
Merged

ref(nitro, nuxt): inline == null checks for nullish detection#22154
logaretm merged 1 commit into
developfrom
feat/consolidate-is-nullish

Conversation

@logaretm

Copy link
Copy Markdown
Member

Adds an isNullish type guard to @sentry/core and replaces the identical isEmptyValue copies in @sentry/nitro and @sentry/nuxt storage instrumentation. Both were value === null || value === undefined with the same value is null | undefined guard, so this is behavior-neutral.

Named isNullish rather than isEmptyValue since it only checks nullishness, not emptiness.

@github-actions

github-actionsBot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.59 kB--
@sentry/browser - with treeshaking flags26.03 kB--
@sentry/browser (incl. Tracing)46.34 kB--
@sentry/browser (incl. Tracing + Span Streaming)48.13 kB--
@sentry/browser (incl. Tracing, Profiling)51.12 kB--
@sentry/browser (incl. Tracing, Replay)85.62 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags75.26 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)90.32 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)102.97 kB--
@sentry/browser (incl. Feedback)44.76 kB--
@sentry/browser (incl. sendFeedback)32.38 kB--
@sentry/browser (incl. FeedbackAsync)37.51 kB--
@sentry/browser (incl. Metrics)28.67 kB--
@sentry/browser (incl. Logs)28.91 kB--
@sentry/browser (incl. Metrics & Logs)29.59 kB--
@sentry/react29.38 kB--
@sentry/react (incl. Tracing)48.61 kB--
@sentry/vue33.02 kB--
@sentry/vue (incl. Tracing)48.31 kB--
@sentry/svelte27.61 kB--
CDN Bundle30 kB--
CDN Bundle (incl. Tracing)48.32 kB--
CDN Bundle (incl. Logs, Metrics)31.57 kB--
CDN Bundle (incl. Tracing, Logs, Metrics)49.64 kB--
CDN Bundle (incl. Replay, Logs, Metrics)70.81 kB--
CDN Bundle (incl. Tracing, Replay)85.84 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)87.14 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)91.64 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)92.92 kB--
CDN Bundle - uncompressed89.35 kB--
CDN Bundle (incl. Tracing) - uncompressed146.1 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed94.05 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed150.07 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed218.78 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed265.3 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed269.26 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed279 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed282.95 kB--
@sentry/nextjs (client)51.16 kB--
@sentry/sveltekit (client)46.78 kB--
@sentry/core/server78.43 kB--
@sentry/core/browser64.76 kB--
@sentry/node-core62.72 kB-0.01%-1 B 🔽
@sentry/node125.37 kB--
@sentry/node (incl. diagnostics channel injection)138.55 kB+0.01%+1 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection)69.95 kB--
@sentry/node/light50.72 kB+0.01%+1 B 🔺
@sentry/node - without tracing74.06 kB--
@sentry/aws-serverless83.25 kB--
@sentry/cloudflare (withSentry) - minified181.71 kB--
@sentry/cloudflare (withSentry)449.16 kB--

View base workflow run

@logaretm
logaretm marked this pull request as ready for review July 9, 2026 18:28
@logaretm
logaretm requested a review from a team as a code ownerJuly 9, 2026 18:28
@logaretm
logaretm requested review from chargome, mydea and nicohrubec and removed request for a teamJuly 9, 2026 18:28

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm maybe I'm missing something but can't we just replace all of these function call with inline wat == null checks? At least for the inverse (something != null) this works.

@logaretm

Copy link
Copy Markdown
MemberAuthor

@Lms24 I think that makes sense, I was thrown off by having a function that checks that already. Will normalize all to == since we have a lot of occurrences.

Replaces the two duplicated `isEmptyValue` helpers with inline `x == null` checks, matching the idiom already used across the codebase, rather than adding a shared helper to core.
@logaretm
logaretmforce-pushed the feat/consolidate-is-nullish branch from ee95f86 to bfb2e4cCompareJuly 9, 2026 18:44
@logaretmlogaretm changed the title feat(core): add isNullish guard and consolidate call sitesref(nitro, nuxt): inline == null checks for nullish detectionJul 9, 2026
@logaretm
logaretm merged commit 7565c90 into developJul 9, 2026
54 checks passed
@logaretm
logaretm deleted the feat/consolidate-is-nullish branch July 9, 2026 19:09
logaretm added a commit that referenced this pull request Jul 17, 2026
…22370)
Adds a item to `AGENTS.md` (`CLAUDE.md` symlinks to it) telling agents
to search for an existing util before writing a new one, pointing at
where shared helpers actually live (`packages/core/src/utils/`,
`packages/browser-utils/`).
Motivation: LLM-assisted changes have a habit of introducing
near-duplicate helpers instead of reusing what's already there. This is
a passive nudge rather than an enforced check.
I did a quick check spawned a couple of agents on bogus tasks that
needed a couple of utils, and watched its reasoning and it picked up on
this, so while it doesn't enforce it, it may help us curb the util soup
we get.
This is a follow up to my previous util cleanup PRs #22155#22163#22154
Sign up for freeto 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

@logaretm@Lms24@andreiborza