From 66a5881fde8f99bb3847007532316d31f41d8afc Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Wed, 15 Apr 2026 19:56:50 -0700 Subject: [PATCH] fix sessionreplay seek issues --- src/app/api/websites/[websiteId]/replays/[replayId]/route.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/api/websites/[websiteId]/replays/[replayId]/route.ts b/src/app/api/websites/[websiteId]/replays/[replayId]/route.ts index eb030c163..ff9a685aa 100644 --- a/src/app/api/websites/[websiteId]/replays/[replayId]/route.ts +++ b/src/app/api/websites/[websiteId]/replays/[replayId]/route.ts @@ -21,7 +21,9 @@ export async function GET( const chunks = await getReplayChunks(websiteId, replayId); - const allEvents = chunks.flatMap(chunk => chunk.events); + const allEvents = chunks + .flatMap(chunk => chunk.events) + .sort((a, b) => a.timestamp - b.timestamp); const sessionId = chunks.length > 0 ? chunks[0].sessionId : null; const startedAt = chunks.length > 0 ? chunks[0].startedAt : null; const endedAt = chunks.length > 0 ? chunks[chunks.length - 1].endedAt : null;