@@ -154,7 +154,7 @@ function createAdLibAction(
154154
155155 if ( innerCtx ) {
156156 try {
157- return compiledAdLibFilter ( innerCtx , true )
157+ return compiledAdLibFilter ( innerCtx )
158158 } catch ( e ) {
159159 triggersContext . logger . error ( e )
160160 return [ ]
@@ -176,83 +176,83 @@ function createAdLibAction(
176176 const currentPartInstanceId = innerCtx . rundownPlaylist . get ( ) . currentPartInfo ?. partInstanceId
177177
178178 const sourceLayerIdsToClear : string [ ] = [ ]
179-
180- const wrappedAdLibs = await compiledAdLibFilter ( innerCtx , false )
181- wrappedAdLibs . forEach ( ( wrappedAdLib ) => {
182- switch ( wrappedAdLib . type ) {
183- case MountedAdLibTriggerType . adLibPiece :
184- triggersContext . doUserAction ( t , e , UserAction . START_ADLIB , async ( e , ts ) =>
185- currentPartInstanceId
186- ? triggersContext . MeteorCall . userAction . segmentAdLibPieceStart (
187- e ,
188- ts ,
189- innerCtx . rundownPlaylistId . get ( ) ,
190- currentPartInstanceId ,
191- wrappedAdLib . item . _id ,
192- false
193- )
194- : ClientAPI . responseSuccess < void > ( undefined )
195- )
196- break
197- case MountedAdLibTriggerType . rundownBaselineAdLibItem :
198- triggersContext . doUserAction ( t , e , UserAction . START_GLOBAL_ADLIB , async ( e , ts ) =>
199- currentPartInstanceId
200- ? triggersContext . MeteorCall . userAction . baselineAdLibPieceStart (
201- e ,
202- ts ,
203- innerCtx . rundownPlaylistId . get ( ) ,
204- currentPartInstanceId ,
205- wrappedAdLib . item . _id ,
206- false
207- )
208- : ClientAPI . responseSuccess < void > ( undefined )
209- )
210- break
211- case MountedAdLibTriggerType . adLibAction :
212- triggersContext . doUserAction ( t , e , UserAction . START_ADLIB , async ( e , ts ) =>
213- triggersContext . MeteorCall . userAction . executeAction (
214- e ,
215- ts ,
216- innerCtx . rundownPlaylistId . get ( ) ,
217- wrappedAdLib . _id ,
218- wrappedAdLib . item . actionId ,
219- wrappedAdLib . item . userData ,
220- ( actionArguments && actionArguments . triggerMode ) || undefined
179+ triggersContext
180+ . nonreactiveTracker ( ( ) => compiledAdLibFilter ( innerCtx ) )
181+ . forEach ( ( wrappedAdLib ) => {
182+ switch ( wrappedAdLib . type ) {
183+ case MountedAdLibTriggerType . adLibPiece :
184+ triggersContext . doUserAction ( t , e , UserAction . START_ADLIB , async ( e , ts ) =>
185+ currentPartInstanceId
186+ ? triggersContext . MeteorCall . userAction . segmentAdLibPieceStart (
187+ e ,
188+ ts ,
189+ innerCtx . rundownPlaylistId . get ( ) ,
190+ currentPartInstanceId ,
191+ wrappedAdLib . item . _id ,
192+ false
193+ )
194+ : ClientAPI . responseSuccess < void > ( undefined )
221195 )
222- )
223- break
224- case MountedAdLibTriggerType . rundownBaselineAdLibAction :
225- triggersContext . doUserAction ( t , e , UserAction . START_GLOBAL_ADLIB , async ( e , ts ) =>
226- triggersContext . MeteorCall . userAction . executeAction (
227- e ,
228- ts ,
229- innerCtx . rundownPlaylistId . get ( ) ,
230- wrappedAdLib . _id ,
231- wrappedAdLib . item . actionId ,
232- wrappedAdLib . item . userData ,
233- ( actionArguments && actionArguments . triggerMode ) || undefined
196+ break
197+ case MountedAdLibTriggerType . rundownBaselineAdLibItem :
198+ triggersContext . doUserAction ( t , e , UserAction . START_GLOBAL_ADLIB , async ( e , ts ) =>
199+ currentPartInstanceId
200+ ? triggersContext . MeteorCall . userAction . baselineAdLibPieceStart (
201+ e ,
202+ ts ,
203+ innerCtx . rundownPlaylistId . get ( ) ,
204+ currentPartInstanceId ,
205+ wrappedAdLib . item . _id ,
206+ false
207+ )
208+ : ClientAPI . responseSuccess < void > ( undefined )
234209 )
235- )
236- break
237- case MountedAdLibTriggerType . clearSourceLayer :
238- // defer this action to send a single clear action all at once
239- sourceLayerIdsToClear . push ( wrappedAdLib . sourceLayerId )
240- break
241- case MountedAdLibTriggerType . sticky :
242- triggersContext . doUserAction ( t , e , UserAction . START_STICKY_PIECE , async ( e , ts ) =>
243- triggersContext . MeteorCall . userAction . sourceLayerStickyPieceStart (
244- e ,
245- ts ,
246- innerCtx . rundownPlaylistId . get ( ) ,
247- wrappedAdLib . sourceLayerId //
210+ break
211+ case MountedAdLibTriggerType . adLibAction :
212+ triggersContext . doUserAction ( t , e , UserAction . START_ADLIB , async ( e , ts ) =>
213+ triggersContext . MeteorCall . userAction . executeAction (
214+ e ,
215+ ts ,
216+ innerCtx . rundownPlaylistId . get ( ) ,
217+ wrappedAdLib . _id ,
218+ wrappedAdLib . item . actionId ,
219+ wrappedAdLib . item . userData ,
220+ ( actionArguments && actionArguments . triggerMode ) || undefined
221+ )
248222 )
249- )
250- break
251- default :
252- assertNever ( wrappedAdLib )
253- return
254- }
255- } )
223+ break
224+ case MountedAdLibTriggerType . rundownBaselineAdLibAction :
225+ triggersContext . doUserAction ( t , e , UserAction . START_GLOBAL_ADLIB , async ( e , ts ) =>
226+ triggersContext . MeteorCall . userAction . executeAction (
227+ e ,
228+ ts ,
229+ innerCtx . rundownPlaylistId . get ( ) ,
230+ wrappedAdLib . _id ,
231+ wrappedAdLib . item . actionId ,
232+ wrappedAdLib . item . userData ,
233+ ( actionArguments && actionArguments . triggerMode ) || undefined
234+ )
235+ )
236+ break
237+ case MountedAdLibTriggerType . clearSourceLayer :
238+ // defer this action to send a single clear action all at once
239+ sourceLayerIdsToClear . push ( wrappedAdLib . sourceLayerId )
240+ break
241+ case MountedAdLibTriggerType . sticky :
242+ triggersContext . doUserAction ( t , e , UserAction . START_STICKY_PIECE , async ( e , ts ) =>
243+ triggersContext . MeteorCall . userAction . sourceLayerStickyPieceStart (
244+ e ,
245+ ts ,
246+ innerCtx . rundownPlaylistId . get ( ) ,
247+ wrappedAdLib . sourceLayerId //
248+ )
249+ )
250+ break
251+ default :
252+ assertNever ( wrappedAdLib )
253+ return
254+ }
255+ } )
256256
257257 if ( currentPartInstanceId && sourceLayerIdsToClear . length > 0 ) {
258258 triggersContext . doUserAction ( t , e , UserAction . CLEAR_SOURCELAYER , async ( e , ts ) =>
@@ -411,12 +411,12 @@ function createUserActionWithCtx(
411411 return {
412412 action : action . action ,
413413 execute : async ( t , e , ctx ) => {
414- triggersContext . doUserAction ( t , e , userAction , async ( e , ts ) => {
415- const innerCtx = await createRundownPlaylistContext ( triggersContext , ctx , action . filterChain )
416- if ( ! innerCtx ) return
417-
418- return userActionExec ( e , ts , innerCtx )
419- } )
414+ const innerCtx = await triggersContext . nonreactiveTracker ( ( ) =>
415+ createRundownPlaylistContext ( triggersContext , ctx , action . filterChain )
416+ )
417+ if ( innerCtx ) {
418+ triggersContext . doUserAction ( t , e , userAction , async ( e , ts ) => userActionExec ( e , ts , innerCtx ) )
419+ }
420420 } ,
421421 }
422422}
0 commit comments