Skip to content

🎥 Make videos programmatically with React

fix(studio): Preserve packed clips when collapsing track children

Jonny Burgera375649e8891
diff --git a/packages/studio/src/components/Timeline/TimelineLayerChildren.tsx b/packages/studio/src/components/Timeline/TimelineLayerChildren.tsx
index 0046693d32..c4a60c6d81 100644
--- a/packages/studio/src/components/Timeline/TimelineLayerChildren.tsx
+++ b/packages/studio/src/components/Timeline/TimelineLayerChildren.tsx
@@ -117,7 +117,7 @@ export const useTimelineLayerChildren = (
}
}
- return {keys, parents, ancestors};
+ return {keys, parents, ancestors, byId};
}, [compositionId, sequences, tracks]);
const toggle = useCallback(
(key: string) => {
@@ -181,6 +181,17 @@ export const useTimelineLayerChildren = (
tracks.filter((track) => {
return !(hierarchy.ancestors.get(track.sequence.id) ?? []).some(
(id) => {
+ // Clips, transitions and overlays draw the packed track itself.
+ // Keep them when that track collapses, hiding only their contents.
+ const packedTrack = track.sequence.timelineTrack;
+ if (
+ packedTrack &&
+ packedTrack.role !== 'track' &&
+ packedTrack.id === hierarchy.byId.get(id)?.timelineTrack?.id
+ ) {
+ return false;
+ }
+
const key = hierarchy.keys.get(id);
return key !== undefined && collapsed[key];
},