Skip to content

Commit facde93

Browse files
committed
fix: clamp negative offset to 0 in getTimeline
Negative offset values passed through to Array.slice() use JS tail-indexing semantics, returning commits from the wrong end of the array and producing nonsensical pagination headers.
1 parent 7dc3211 commit facde93

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/agent-react-devtools/src/profiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export class Profiler {
324324
}));
325325

326326
if (sort === 'duration') all.sort((a, b) => b.duration - a.duration);
327-
const start = offset ?? 0;
327+
const start = Math.max(0, offset ?? 0);
328328
return {
329329
entries: all.slice(start, start + limit),
330330
total: all.length,

0 commit comments

Comments
 (0)