change(tracker): fix tracker crash on performance entry missing (/browser api issue?)
This commit is contained in:
parent
04a768ee80
commit
702e2f3def
1 changed files with 4 additions and 2 deletions
|
|
@ -38,8 +38,10 @@ type FetchRequestBody = RequestInit['body']
|
|||
function checkCacheByPerformanceTimings(requestUrl: string) {
|
||||
if (performance) {
|
||||
const timings = performance.getEntriesByName(requestUrl)[0]
|
||||
// @ts-ignore - weird ts typings, please refer to https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming
|
||||
return timings.transferSize === 0 || timings.responseStart - timings.requestStart < 10
|
||||
if (timings) {
|
||||
// @ts-ignore - weird ts typings, please refer to https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming
|
||||
return timings.transferSize === 0 || timings.responseStart - timings.requestStart < 10
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue