🎥 Make videos programmatically with React
fix race condition
JonnyBurger5e4ecca2450b
diff --git a/.claude/skills/visual-mode/SKILL.md b/.claude/skills/visual-mode/SKILL.mdnew file mode 100644index 0000000000..4411eafa85--- /dev/null+++ b/.claude/skills/visual-mode/SKILL.md@@ -0,0 +1,24 @@+Visual Mode is a feature in Remotion Studio that allows one to visually edit Sequences.++I've made the following observations:++## Fields++- overrideId -> does keep the identity the same of a sequence, even if the file / line / column changes+- Sequence `stack` -> changes on hot reload. shared by multiple sequences which have different overrideIds+- Sequence file, line, column (symbolicated stack) -> does not change, but needs to be calculated asyn+- `nodePath` -> same identity, even if line, stack and overrideId changes. async++nodePath + index is ideal way to keep track of the expanded state. that’s the end goal.++Once nodePath is mapped to `overrideId`, it doesn’t change otherwise component would remount and overrideId works change.++If the same `stack` is found already used by another sequence, we re-use the `overrideId`.++`nodePath` to symbolicated stack could theoretically change on every file change. but multiple sequences can share the same stack and then they all have the same nodePath.++We should only fetch the nodepath for every stack once++different unsymbolicated stacks could lead to the same symbolicated stack, because of fast refresh++unsymbolicated to symbolicated stack does never change because if it does, it is a different stack due to fast refreshdiff --git a/packages/studio/src/components/Timeline/TimelineExpandArrowButton.tsx b/packages/studio/src/components/Timeline/TimelineExpandArrowButton.tsxindex 91c2e2a072..50a615f4b5 100644--- a/packages/studio/src/components/Timeline/TimelineExpandArrowButton.tsx+++ b/packages/studio/src/components/Timeline/TimelineExpandArrowButton.tsx@@ -25,19 +25,23 @@ export const TimelineExpandArrowButton: React.FC<{readonly isExpanded: boolean;readonly onClick: () => void;readonly label: string;-}> = ({isExpanded, onClick, label}) => {+ readonly disabled: boolean;+}> = ({isExpanded, onClick, label, disabled = false}) => {const style: React.CSSProperties = useMemo(() => {return {...arrowButton,transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',+ cursor: disabled ? 'default' : 'pointer',+ opacity: disabled ? 0.5 : 1,};- }, [isExpanded]);+ }, [isExpanded, disabled]);return (<buttontype="button"style={style}onClick={onClick}+ disabled={disabled}aria-expanded={isExpanded}aria-label={`${isExpanded ? 'Collapse' : 'Expand'} ${label}`}>diff --git a/packages/studio/src/components/Timeline/TimelineExpandedRow.tsx b/packages/studio/src/components/Timeline/TimelineExpandedRow.tsxindex 971e41a50f..a2b64f3ba6 100644--- a/packages/studio/src/components/Timeline/TimelineExpandedRow.tsx+++ b/packages/studio/src/components/Timeline/TimelineExpandedRow.tsx@@ -78,6 +78,7 @@ export const TimelineExpandedRow: React.FC<{isExpanded={isExpanded}onClick={() => toggleTrack(node.nodePathInfo)}label={`${node.label} section`}+ disabled={false}/><span style={rowLabel}>{node.label}</span></div>diff --git a/packages/studio/src/components/Timeline/TimelineListItem.tsx b/packages/studio/src/components/Timeline/TimelineListItem.tsxindex 2a7e0f2c43..db191c5f72 100644--- a/packages/studio/src/components/Timeline/TimelineListItem.tsx+++ b/packages/studio/src/components/Timeline/TimelineListItem.tsx@@ -255,6 +255,7 @@ export const TimelineListItem: React.FC<{isExpanded={isExpanded}onClick={onToggleExpand}label="track properties"+ disabled={nodePathInfo === null}/>) : (<TimelineExpandArrowSpacer />