@@ -105,7 +105,8 @@ export function findLookaheadObjectsForPart(
105105 for ( const rawPiece of partInfo . pieces ) {
106106 if ( shouldIgnorePiece ( partInfo , rawPiece ) ) continue
107107
108- const obj = getObjectMapForPiece ( rawPiece ) . get ( layer )
108+ const rawObj = getObjectMapForPiece ( rawPiece ) . get ( layer )
109+ const obj = rawObj ? structuredClone ( rawObj ) : undefined
109110
110111 // we only consider lookahead objects for lookahead and calculate the lookaheadOffset for each object.
111112 const computedLookaheadObj = computeLookaheadObject ( obj , rawPiece , partInfo , partInstanceId , nextTimeOffset )
@@ -131,7 +132,14 @@ export function findLookaheadObjectsForPart(
131132 if ( allObjs . length === 1 ) {
132133 // Only one, just return it
133134 const obj = allObjs [ 0 ]
134- const patchedContent = tryActivateKeyframesForObject ( obj , ! ! transitionPiece , classesFromPreviousPart )
135+ const patchedContent = tryActivateKeyframesForObject (
136+ {
137+ ...obj ,
138+ content : structuredClone ( obj . content ) ,
139+ } ,
140+ ! ! transitionPiece ,
141+ classesFromPreviousPart
142+ )
135143
136144 return [
137145 {
@@ -144,7 +152,7 @@ export function findLookaheadObjectsForPart(
144152
145153 const res : Array < LookaheadTimelineObject > = [ ]
146154 allObjs . map ( ( obj ) => {
147- const piece = partInfo . pieces . find ( ( piece ) => unprotectString ( piece . _id ) === obj . pieceInstanceId )
155+ const piece = partInfo . pieces . find ( ( piece ) => unprotectString ( piece . _id ) === getBestPieceInstanceId ( piece ) )
148156 if ( ! piece ) return
149157
150158 // If there is a transition and this piece is abs0, it is assumed to be the primary piece and so does not need lookahead
@@ -158,7 +166,14 @@ export function findLookaheadObjectsForPart(
158166 }
159167
160168 if ( obj ) {
161- const patchedContent = tryActivateKeyframesForObject ( obj , ! ! transitionPiece , classesFromPreviousPart )
169+ const patchedContent = tryActivateKeyframesForObject (
170+ {
171+ ...obj ,
172+ content : structuredClone ( obj . content ) ,
173+ } ,
174+ ! ! transitionPiece ,
175+ classesFromPreviousPart
176+ )
162177
163178 res . push (
164179 literal < LookaheadTimelineObject > ( {
0 commit comments