diff --git a/services/editor/apps/web/src/components/editor/Timeline.tsx b/services/editor/apps/web/src/components/editor/Timeline.tsx index 2b66f4e..317b02d 100644 --- a/services/editor/apps/web/src/components/editor/Timeline.tsx +++ b/services/editor/apps/web/src/components/editor/Timeline.tsx @@ -486,13 +486,14 @@ export const Timeline: React.FC = () => { return () => document.removeEventListener("mouseup", handleMouseUp); }, [isBoxSelecting, handleBoxSelectionEnd]); + // Returns the ActionResult so callers can check success and surface errors const handleDropMedia = useCallback( async (trackId: string, mediaId: string, startTime: number) => { const { addClip, addClipToNewTrack } = useProjectStore.getState(); if (trackId) { - await addClip(trackId, mediaId, startTime); + return addClip(trackId, mediaId, startTime); } else { - await addClipToNewTrack(mediaId, startTime); + return addClipToNewTrack(mediaId, startTime); } }, [], @@ -1078,9 +1079,14 @@ export const Timeline: React.FC = () => { if (!rawData) return; const data = JSON.parse(rawData); if (!data?.mediaId) return; - handleDropMedia("", data.mediaId, snappedTime); - } catch { - // ignore + const result = await handleDropMedia("", data.mediaId, snappedTime); + if (result && !result.success) { + console.error("[Timeline] Failed to add clip to timeline:", result.error); + toast.error("Failed to add clip to timeline", result.error?.message ?? ""); + } + } catch (err) { + console.error("[Timeline] Drop error:", err); + toast.error("Failed to add clip to timeline", String(err)); } }} >