Skip to content

Commit 3623454

Browse files
committed
fix latestSpanEndTimestamp calc
1 parent f0ec4e0 commit 3623454

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/tracing/idleSpan.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ export function startIdleSpan(startSpanOptions: StartSpanOptions, options: Parti
171171
// Otherwise, we adjust the end timestamp of the idle span to the latest span end timestamp of its children
172172
const latestSpanEndTimestamp = spans?.reduce((acc: number | undefined, current) => {
173173
const currentSpanJson = spanToJSON(current);
174-
if (acc == null) {
175-
return currentSpanJson.timestamp;
174+
if (!currentSpanJson.timestamp) {
175+
return acc;
176176
}
177-
return Math.max(acc, currentSpanJson.timestamp || 0);
177+
return acc ? Math.max(acc, currentSpanJson.timestamp) : currentSpanJson.timestamp;
178178
}, undefined);
179179

180180
// In reality this should always exist here, but type-wise it may be undefined...

0 commit comments

Comments
 (0)