Skip to content
← All reviews
vercel/next.js #95920 · dayongkr · 4mo ago

fix: wire experimental.webVitalsAttribution into useReportWebVitals

Needs attention1 finding · openOpen the pull request on GitHub ↗
Panel verdict

The panel surfaced issues that deserve attention before merge.

1
raised by reviewers
1
kept by the panel

Findings

HighArchitectureconfidence 0.95

process.env.__NEXT_HAS_WEB_VITALS_ATTRIBUTION is always a string, not a boolean

The condition if (process.env.__NEXT_HAS_WEB_VITALS_ATTRIBUTION) checks a string environment variable for truthiness. In Next.js, compile-time env vars like __NEXT_HAS_WEB_VITALS_ATTRIBUTION are replaced with the string 'true' or 'false' (or are undefined). The string 'false' is truthy in JavaScript, so this condition will always be true when the env var is defined, even when attribution is disabled. This means the attribution bundle will always be loaded and checked against the attributions list, even when experimental.webVitalsAttribution is not configured. This is a bug that causes unnecessary bundle loading and potential runtime overhead.

Suggested fix ·

if (attributions?.length) {

3 reviewers · deepseek/deepseek-v4-flash · reviewed in 38s · 6 files, +114 −17

Ship the PR.
Skip the noise.

Free on 2 repositories · No credit card · Advisory only—never blocks a merge