next.js
15fcfb9c - docs: fix navigationType value and variable name in useReportWebVitals (#90599)

Commit
7 days ago
docs: fix navigationType value and variable name in useReportWebVitals (#90599) ## For Contributors ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### What? Fix two bugs in the `useReportWebVitals` API reference docs: 1. `navigationType` value `"back_forward"` → `"back-forward"`: the `web-vitals` library intentionally renames this value to use a hyphen for consistency. 2. Variable name mismatch in `handleCustomMetrics` example: parameter was named `metrics` (plural) but the function body referenced `metric.name` (singular), causing a `ReferenceError`. ### Why? The `navigationType` description reflected the raw `PerformanceNavigationTiming` API value (`"back_forward"`), not the actual value emitted by the `web-vitals` library (`"back-forward"`), which `useReportWebVitals` is built on top of Ref: https://github.com/GoogleChrome/web-vitals?tab=readme-ov-file#types The variable name mismatch in the code example would cause a `ReferenceError` if copied as-is. ### How? - Updated `navigationType` description to use `"back-forward"`. - Renamed parameter `metrics` → `metric` in the `handleCustomMetrics` example --------- Co-authored-by: Joseph <sephxd1234@gmail.com> Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Author
Parents
Loading