fix: Auto Edit no longer throws "setCompositionParams is not defined"

handleAutoEdit referenced setCompositionParams and setShowPreviewModal — neither exists in ResultCard, leftovers from a prior refactor. Align it with handleSubtitle/handleHook: accumulate the generated effects into activeLayers and re-render the clip via renderInBrowser.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
juancarlos.cavero 2026-04-30 07:09:49 +02:00
parent 42ca76c48b
commit 9575b774d0

View file

@ -88,8 +88,17 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
if (effectsRes.ok) {
const data = await effectsRes.json();
if (data.effects && data.effects.segments) {
setCompositionParams(prev => ({ ...prev, effects: data.effects }));
setShowPreviewModal(true);
const newLayers = { ...activeLayers, effects: data.effects };
setActiveLayers(newLayers);
const blobUrl = await renderInBrowser({
videoUrl: originalVideoUrl,
durationInSeconds: clipDuration,
subtitles: newLayers.subtitles,
hook: newLayers.hook,
effects: newLayers.effects,
});
setCurrentVideoUrl(blobUrl);
if (videoRef.current) videoRef.current.load();
return;
}
}