Skip to content

Commit e1df70a

Browse files
jstarplJulusian
authored andcommitted
fix: Device Action Studio Context gets lost, Adlib previews are unstable
# Conflicts: # meteor/server/api/deviceTriggers/StudioDeviceTriggerManager.ts # meteor/server/api/deviceTriggers/observer.ts
1 parent 8338eab commit e1df70a

File tree

4 files changed

+227
-151
lines changed

4 files changed

+227
-151
lines changed

meteor/server/api/deviceTriggers/RundownContentObserver.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ export class RundownContentObserver {
3333
#observers: Meteor.LiveQueryHandle[] = []
3434
#cache: ContentCache
3535
#cancelCache: () => void
36-
#cleanup: () => void = () => {
36+
#cleanup: (() => void) | undefined = () => {
3737
throw new Error('RundownContentObserver.#cleanup has not been set!')
3838
}
3939
#disposed = false
4040

4141
private constructor(onChanged: ChangedHandler) {
4242
const { cache, cancel: cancelCache } = createReactiveContentCache(() => {
43+
if (this.#disposed) {
44+
this.#cleanup?.()
45+
return
46+
}
4347
this.#cleanup = onChanged(cache)
44-
if (this.#disposed) this.#cleanup()
4548
}, REACTIVITY_DEBOUNCE)
4649

4750
this.#cache = cache
@@ -173,5 +176,6 @@ export class RundownContentObserver {
173176
this.#cancelCache()
174177
this.#observers.forEach((observer) => observer.stop())
175178
this.#cleanup?.()
179+
this.#cleanup = undefined
176180
}
177181
}

0 commit comments

Comments
 (0)