Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(workflows): restore video duration when edit render fails
Richie McIlroyed52edc827f3
diff --git a/apps/web/workflows/edit-video.ts b/apps/web/workflows/edit-video.tsindex e8da4ef19..7d4f1f6b2 100644--- a/apps/web/workflows/edit-video.ts+++ b/apps/web/workflows/edit-video.ts@@ -758,15 +758,29 @@ async function saveEditResultAndComplete(async function clearEditProcessingState(videoId: string,sourceKey: string,+ previousSpec: VideoEditSpec,): Promise<void> {"use step";- await db()- .delete(videoUploads)- .where(- and(- eq(videoUploads.videoId, videoId as Video.VideoId),- eq(videoUploads.rawFileKey, sourceKey),- ),- );+ const previousDuration = getValidDuration(+ getEditSpecOutputDuration(previousSpec),+ );++ await db().transaction(async (tx) => {+ if (previousDuration !== undefined) {+ await tx+ .update(videos)+ .set({ duration: previousDuration })+ .where(eq(videos.id, videoId as Video.VideoId));+ }++ await tx+ .delete(videoUploads)+ .where(+ and(+ eq(videoUploads.videoId, videoId as Video.VideoId),+ eq(videoUploads.rawFileKey, sourceKey),+ ),+ );+ });}