From 82e7b8b06ed3df199470517b7bff8bbc7ba81faa Mon Sep 17 00:00:00 2001 From: Alberto Delgado Roda Date: Fri, 28 Jul 2023 11:36:23 +0200 Subject: [PATCH] chore: make mark exist before subtracting time --- .../src/performance-monitoring/navigation/marks.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/rum-core/src/performance-monitoring/navigation/marks.js b/packages/rum-core/src/performance-monitoring/navigation/marks.js index 12e7065f0..19387e0ca 100644 --- a/packages/rum-core/src/performance-monitoring/navigation/marks.js +++ b/packages/rum-core/src/performance-monitoring/navigation/marks.js @@ -106,10 +106,13 @@ function getNavigationTimingMarks(timing) { const marks = {} NAVIGATION_TIMING_MARKS.forEach(function (timingKey) { const m = timing[timingKey] - if (isRedirectInfoAvailable(timing)) { - marks[timingKey] = parseInt(m - redirectStart) - } else if (m && m >= fetchStart) { - marks[timingKey] = parseInt(m - fetchStart) + if (m && m >= fetchStart) { + if (isRedirectInfoAvailable(timing)) { + // make sure navigation marks will show up after the Redirect span + marks[timingKey] = parseInt(m - redirectStart) + } else { + marks[timingKey] = parseInt(m - fetchStart) + } } }) return marks