Skip to content

Commit 193815d

Browse files
committed
fix: Device Action Studio Context gets lost, Adlib previews are unstable
1 parent 0ae53c4 commit 193815d

File tree

4 files changed

+225
-155
lines changed

4 files changed

+225
-155
lines changed

meteor/server/api/deviceTriggers/RundownContentObserver.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class RundownContentObserver {
3232
#observers: Meteor.LiveQueryHandle[] = []
3333
#cache: ContentCache
3434
#cancelCache: () => void
35-
#cleanup: () => void = () => {
35+
#cleanup: (() => void) | undefined = () => {
3636
throw new Error('RundownContentObserver.#cleanup has not been set!')
3737
}
3838
#disposed = false
@@ -45,8 +45,11 @@ export class RundownContentObserver {
4545
) {
4646
logger.silly(`Creating RundownContentObserver for playlist "${rundownPlaylistId}"`)
4747
const { cache, cancel: cancelCache } = createReactiveContentCache(() => {
48+
if (this.#disposed) {
49+
this.#cleanup?.()
50+
return
51+
}
4852
this.#cleanup = onChanged(cache)
49-
if (this.#disposed) this.#cleanup()
5053
}, REACTIVITY_DEBOUNCE)
5154

5255
this.#cache = cache
@@ -157,5 +160,6 @@ export class RundownContentObserver {
157160
this.#cancelCache()
158161
this.#observers.forEach((observer) => observer.stop())
159162
this.#cleanup?.()
163+
this.#cleanup = undefined
160164
}
161165
}

0 commit comments

Comments
 (0)