move stitching calculation to server side

This commit is contained in:
Francis Cao committed 2026-03-03 16:28:09 -08:00
1 parent 4ecef2e290
commit b2d45613b5
4 files changed
+22 -22

No files matched your search

@@ -1,3 +1,4 @@
import { stitchChunkEvents } from '@/lib/replay';
import { parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { canViewWebsite } from '@/permissions';
@@ -21,7 +22,7 @@ export async function GET(
const chunks = await getReplayChunks(websiteId, sessionId);
const allEvents = chunks.flatMap(chunk => chunk.events);
const allEvents = stitchChunkEvents(chunks);
const startedAt = chunks.length > 0 ? chunks[0].startedAt : null;
const endedAt = chunks.length > 0 ? chunks[chunks.length - 1].endedAt : null;