docs: next/web-vitals is implemented, not a no-op stub - #3001
Open
ting-hong-shieh wants to merge 1 commit into
Open
docs: next/web-vitals is implemented, not a no-op stub#3001ting-hong-shieh wants to merge 1 commit into
ting-hong-shieh wants to merge 1 commit into
Conversation
Both the README API coverage table and the shipped migrate-to-vinext skill list `next/web-vitals` as an intentional stub. The shim is a real implementation: `useReportWebVitals` subscribes to CLS, FID, LCP, INP, FCP, and TTFB via the `web-vitals` package and forwards each metric to the caller's callback. `check.ts` already reports the module as supported, so a user running `vinext check` and a user reading the README were told opposite things, and the README's advice to "use the `web-vitals` library directly" steered people away from a working API. The `_app`-based `reportWebVitals` export is a separate Pages Router API and is still not wired up, so the note says so.
commit: |
Contributor
Performance benchmarksCompared 1 improved · 0 regressed · 5 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The README and the shipped
migrate-to-vinextskill both listnext/web-vitalsas an intentional no-op stub. It is a working implementation, andcheck.tsalready says so — the docs are the ones that are wrong.The implementation
packages/vinext/src/shims/web-vitals.tssubscribes to all six metrics and forwards each to the caller:web-vitalsis a real dependency (packages/vinext/package.json:183), the public signature is declared inpackages/types/next/next-shims-vinext.d.ts:13, and there is an E2E test ported from Next.js's own suite —tests/e2e/app-router/nextjs-compat/web-vitals.spec.ts, fromtest/e2e/app-dir/app/useReportWebVitals.test.ts— which asserts the browser actually reports the full set:The disagreement
packages/vinext/src/check.ts:113supported— "reportWebVitals helper"README.mdAPI coverage tableweb-vitalslibrary directly)".agents/skills/migrate-to-vinext/references/compatibility.mdStub— "No-op"So
vinext checkand the README told a user opposite things about the same module, and the README's advice actively steered people away from an API that works. The skill matters here too, since it ships to users vianpx skills add cloudflare/vinextand is what an agent reads when deciding what to migrate.Scope
Docs only — no behavior change. I marked the row ✅ per the legend ("full implementation") because the module's only export is
useReportWebVitals.One thing I deliberately did not claim: the Pages Router
_appreportWebVitalsexport is a separate Next.js API and is not wired up (grep -rn reportWebVitals packages/vinext/src/returns only the shim and thecheck.tsentry). The new skill note says "not the_appexport" so that gap stays visible.Verification
State: base
7ed5570, head39a3996.pnpm run fmt:checkpasses at head (3098 files). I did not run the E2E suite locally — the spec above is cited as existing CI coverage for the behavior, not as something I re-ran. No source files are touched, so no unit test outcome should change.