Skip to content

Commit fab9d1c

Browse files
authored
Avoid no-floating-promises ESLint problem
1 parent 9673858 commit fab9d1c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

packages/cra-template/template/src/reportWebVitals.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
const reportWebVitals = onPerfEntry => {
1+
const reportWebVitals = (onPerfEntry) => {
22
if (onPerfEntry && onPerfEntry instanceof Function) {
3-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4-
getCLS(onPerfEntry);
5-
getFID(onPerfEntry);
6-
getFCP(onPerfEntry);
7-
getLCP(onPerfEntry);
8-
getTTFB(onPerfEntry);
9-
});
3+
import('web-vitals')
4+
.then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
5+
getCLS(onPerfEntry);
6+
getFID(onPerfEntry);
7+
getFCP(onPerfEntry);
8+
getLCP(onPerfEntry);
9+
getTTFB(onPerfEntry);
10+
})
11+
.catch(() => {});
1012
}
1113
};
1214

0 commit comments

Comments
 (0)