fix(studio): address PR review — restore rollback, fix probe race, harden edit suppression

Restore rollback path: enqueueEdit now returns the queued promise so
Promise.resolve(handler(...)).catch(rollback) in useTimelineClipDrag
fires correctly on save failure. Handlers return the promise chain.

Fix lost-update race in probe enrichment: use zustand's functional
setState so concurrent probe completions each read the latest state
atomically instead of all reading the same stale snapshot.

Harden file-change suppression: pendingTimelineEditPathRef is now a
Set<string> with exact-match lookup instead of single-slot + endsWith.
Multiple concurrent edits on different files are all suppressed correctly.

Remove dead canOffsetTrimClipStart function and its tests — no longer
called after the capability gate simplification.

Document runtime sync mechanism: added comment explaining that the
runtime re-reads data attributes on each sync tick (init.ts:1324-1368).

Fix comment wording in patchIframeDomTiming catch block.
This commit is contained in:
Miguel Ángel
2026-05-19 20:59:45 -04:00
parent beb807493c
commit 366fcc2a64
6 changed files with 39 additions and 85 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ export function StudioApp() {
});
const editHistory = usePersistentEditHistory({ projectId });
const domEditSaveTimestampRef = useRef(0);
const pendingTimelineEditPathRef = useRef<string | null>(null);
const pendingTimelineEditPathRef = useRef(new Set<string>());
const reloadPreview = useCallback(() => {
setRefreshKey((k) => k + 1);
}, []);