Skip to content

Commit

Permalink
chore: fix double cleanup in publication
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Feb 3, 2025
1 parent 286e301 commit 1cb07b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion meteor/server/publications/lib/rundownsObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ export class RundownsObserver implements Meteor.LiveQueryHandle {
if (this.#disposed) return
if (!this.#changed) return
this.#cleanup?.()
this.#cleanup = undefined

const changed = this.#changed
this.#cleanup = await changed(this.rundownIds)

if (this.#disposed) this.#cleanup?.()
if (this.#disposed) {
this.#cleanup?.()
this.#cleanup = undefined
}
}, REACTIVITY_DEBOUNCE)

private constructor(onChanged: ChangedHandler) {
Expand Down Expand Up @@ -109,5 +113,6 @@ export class RundownsObserver implements Meteor.LiveQueryHandle {
this.#rundownsLiveQuery.stop()
this.#changed = undefined
this.#cleanup?.()
this.#cleanup = undefined
}
}

0 comments on commit 1cb07b3

Please sign in to comment.