Skip to content

Commit

Permalink
build(deps): bump web-vitals from 2.1.4 to 4.0.0 (#15)
Browse files Browse the repository at this point in the history
* ---
updated-dependencies:
- dependency-name: web-vitals
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* build: Fix reportWebVitals to use MetricType type

GoogleChrome/web-vitals#483

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yuta Kusuno <[email protected]>
  • Loading branch information
dependabot[bot] and yutakusuno authored May 22, 2024
1 parent 8b67f94 commit 676f868
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"react-scripts": "5.0.1",
"react-select": "^5.7.4",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
"web-vitals": "^4.0.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down
18 changes: 10 additions & 8 deletions src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { ReportHandler } from 'web-vitals';
// https://github.com/GoogleChrome/web-vitals/pull/483

const reportWebVitals = (onPerfEntry?: ReportHandler) => {
import { MetricType } from 'web-vitals';

const reportWebVitals = (onPerfEntry?: (metric: MetricType) => void) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
import('web-vitals').then(({ onCLS, onINP, onFCP, onLCP, onTTFB }) => {
onCLS(onPerfEntry);
onINP(onPerfEntry);
onFCP(onPerfEntry);
onLCP(onPerfEntry);
onTTFB(onPerfEntry);
});
}
};
Expand Down

0 comments on commit 676f868

Please sign in to comment.