@@ -95,7 +95,7 @@ function createAction(
9595 actions : SomeAction [ ] ,
9696 showStyleBase : UIShowStyleBase ,
9797 t : TFunction ,
98- collectContext : ( ) => ReactivePlaylistActionContext | null
98+ collectContext : ( computation : Tracker . Computation | null ) => ReactivePlaylistActionContext | null
9999) : {
100100 listener : HotkeyTriggerListener
101101 preview : ( computation : Tracker . Computation ) => Promise < IWrappedAdLib [ ] >
@@ -106,25 +106,23 @@ function createAction(
106106 return {
107107 preview : async ( computation : Tracker . Computation ) => {
108108 const trackerComputation = computation as any as TriggerTrackerComputation
109- const ctx = collectContext ( )
110- if ( ctx ) {
111- return flatten (
112- await Promise . all (
113- executableActions . map (
114- async ( action ) : Promise < IWrappedAdLib [ ] > =>
115- isPreviewableAction ( action ) ? action . preview ( ctx , trackerComputation ) : [ ]
116- )
109+ const ctx = collectContext ( computation )
110+ if ( ! ctx ) return [ ]
111+
112+ return flatten (
113+ await Promise . all (
114+ executableActions . map (
115+ async ( action ) : Promise < IWrappedAdLib [ ] > =>
116+ isPreviewableAction ( action ) ? action . preview ( ctx , trackerComputation ) : [ ]
117117 )
118118 )
119- } else {
120- return [ ]
121- }
119+ )
122120 } ,
123121 listener : ( e ) => {
124122 e . preventDefault ( )
125123 e . stopPropagation ( )
126124
127- const ctx = collectContext ( )
125+ const ctx = collectContext ( null )
128126 if ( ctx ) {
129127 executableActions . forEach ( ( action ) =>
130128 Promise . resolve ( )
@@ -143,8 +141,8 @@ const rundownPlaylistContext: ReactiveVar<ReactivePlaylistActionContext | null>
143141function setRundownPlaylistContext ( ctx : ReactivePlaylistActionContext | null ) {
144142 rundownPlaylistContext . set ( ctx )
145143}
146- function getCurrentContext ( ) : ReactivePlaylistActionContext | null {
147- return rundownPlaylistContext . get ( )
144+ function getCurrentContext ( computation : Tracker . Computation | null ) : ReactivePlaylistActionContext | null {
145+ return rundownPlaylistContext . get ( computation ?? undefined )
148146}
149147
150148export const MountedAdLibTriggers = createInMemorySyncMongoCollection < MountedAdLibTrigger & MountedHotkeyMixin > (
0 commit comments