Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Keep outline controls current

Jonny Burgerd25247df2fed
diff --git a/packages/studio/src/components/SelectedOutlineOverlay.tsx b/packages/studio/src/components/SelectedOutlineOverlay.tsx
index 96571b4209..fc081e495b 100644
--- a/packages/studio/src/components/SelectedOutlineOverlay.tsx
+++ b/packages/studio/src/components/SelectedOutlineOverlay.tsx
@@ -946,9 +946,6 @@ const SelectedOutlineOverlayUnmemoized: React.FC<
],
);
- const calculateOutlineTargetsRef = useRef(
- calculateOutlineTargetsForCurrentState,
- );
const getSelectableOutlinesRef = useRef(getSelectableOutlines);
const selectableOutlinesCacheRef = useRef<{
readonly getSelectableOutlines: typeof getSelectableOutlines;
@@ -958,9 +955,8 @@ const SelectedOutlineOverlayUnmemoized: React.FC<
readonly timelinePosition: number;
} | null>(null);
useLayoutEffect(() => {
- calculateOutlineTargetsRef.current = calculateOutlineTargetsForCurrentState;
getSelectableOutlinesRef.current = getSelectableOutlines;
- }, [calculateOutlineTargetsForCurrentState, getSelectableOutlines]);
+ }, [getSelectableOutlines]);
const getSelectableOutlinesAtFrame = useCallback(
(timelinePosition: number) => {
const currentGetSelectableOutlines = getSelectableOutlinesRef.current;
@@ -985,7 +981,7 @@ const SelectedOutlineOverlayUnmemoized: React.FC<
const getLatestOutlineTargetByKey = useCallback(
(key: string) => {
const timelinePosition = getCurrentFrame();
- const target = calculateOutlineTargetsRef.current({
+ const target = calculateOutlineTargetsForCurrentState({
mode: 'controls',
runtimeValuesByStore: new Map(),
selectableOutlines: getSelectableOutlinesAtFrame(timelinePosition),
@@ -994,7 +990,11 @@ const SelectedOutlineOverlayUnmemoized: React.FC<
})[0];
return target as SelectedOutlineTarget | undefined;
},
- [getCurrentFrame, getSelectableOutlinesAtFrame],
+ [
+ calculateOutlineTargetsForCurrentState,
+ getCurrentFrame,
+ getSelectableOutlinesAtFrame,
+ ],
);
const getCurrentSelectableOutlines = useCallback(
() => getSelectableOutlinesAtFrame(getCurrentFrame()),