Skip to content

Commit df24bf0

Browse files
committed
fix
1 parent a9c0569 commit df24bf0

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

packages/webui/src/client/lib/triggers/TriggersHandler.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
143141
function 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

150148
export const MountedAdLibTriggers = createInMemorySyncMongoCollection<MountedAdLibTrigger & MountedHotkeyMixin>(

packages/webui/src/meteor/reactive-var.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const ReactiveVar = function (initialValue, equalsFunc) {
6262
* @locus Client
6363
*/
6464
ReactiveVar.prototype.get = function (computation) {
65-
if (Tracker.active)
65+
if (Tracker.active || computation)
6666
this.dep.depend(computation);
6767

6868
return this.curValue;

0 commit comments

Comments
 (0)