@@ -65,7 +65,10 @@ meteorPublish(PeripheralDevicePubSub.rundownsForDevice, async function (deviceId
6565 throw new Meteor . Error ( 403 , 'Publication can only be used by authorized PeripheralDevices' )
6666
6767 // No studio, then no rundowns
68- if ( ! resolvedCred . device . studioId ) return null
68+ if ( ! resolvedCred . device . studioId ) {
69+ this . ready ( )
70+ return null
71+ }
6972
7073 selector . studioId = resolvedCred . device . studioId
7174
@@ -87,7 +90,10 @@ meteorPublish(
8790 check ( playlistIds , Array )
8891
8992 // If values were provided, they must have values
90- if ( playlistIds . length === 0 ) return null
93+ if ( playlistIds . length === 0 ) {
94+ this . ready ( )
95+ return null
96+ }
9197
9298 const { cred, selector } = await AutoFillSelector . organizationId < DBRundown > (
9399 this . userId ,
@@ -121,7 +127,10 @@ meteorPublish(
121127 async function ( showStyleBaseIds : ShowStyleBaseId [ ] , token : string | undefined ) {
122128 check ( showStyleBaseIds , Array )
123129
124- if ( showStyleBaseIds . length === 0 ) return null
130+ if ( showStyleBaseIds . length === 0 ) {
131+ this . ready ( )
132+ return null
133+ }
125134
126135 const { cred, selector } = await AutoFillSelector . organizationId < DBRundown > (
127136 this . userId ,
@@ -156,7 +165,10 @@ meteorPublish(
156165 async function ( rundownIds : RundownId [ ] , filter : { omitHidden ?: boolean } | undefined , token : string | undefined ) {
157166 check ( rundownIds , Array )
158167
159- if ( rundownIds . length === 0 ) return null
168+ if ( rundownIds . length === 0 ) {
169+ this . ready ( )
170+ return null
171+ }
160172
161173 const selector : MongoQuery < DBSegment > = {
162174 rundownId : { $in : rundownIds } ,
@@ -183,8 +195,14 @@ meteorPublish(
183195 check ( rundownIds , Array )
184196 check ( segmentIds , Match . Maybe ( Array ) )
185197
186- if ( rundownIds . length === 0 ) return null
187- if ( segmentIds && segmentIds . length === 0 ) return null
198+ if ( rundownIds . length === 0 ) {
199+ this . ready ( )
200+ return null
201+ }
202+ if ( segmentIds && segmentIds . length === 0 ) {
203+ this . ready ( )
204+ return null
205+ }
188206
189207 const modifier : FindOptions < DBPart > = {
190208 fields : {
@@ -219,7 +237,10 @@ meteorPublish(
219237 check ( rundownIds , Array )
220238 check ( playlistActivationId , Match . Maybe ( String ) )
221239
222- if ( rundownIds . length === 0 || ! playlistActivationId ) return null
240+ if ( rundownIds . length === 0 || ! playlistActivationId ) {
241+ this . ready ( )
242+ return null
243+ }
223244
224245 const modifier : FindOptions < DBPartInstance > = {
225246 fields : {
@@ -252,7 +273,10 @@ meteorPublish(
252273 ) {
253274 check ( rundownIds , Array )
254275
255- if ( rundownIds . length === 0 ) return null
276+ if ( rundownIds . length === 0 ) {
277+ this . ready ( )
278+ return null
279+ }
256280
257281 const selector : MongoQuery < DBPartInstance > = {
258282 rundownId : { $in : rundownIds } ,
@@ -290,7 +314,10 @@ meteorPublish(
290314 check ( partIds , Match . Maybe ( Array ) )
291315
292316 // If values were provided, they must have values
293- if ( partIds && partIds . length === 0 ) return null
317+ if ( partIds && partIds . length === 0 ) {
318+ this . ready ( )
319+ return null
320+ }
294321
295322 const selector : MongoQuery < Piece > = {
296323 startRundownId : { $in : rundownIds } ,
@@ -361,7 +388,10 @@ const adlibPiecesSubFields: MongoFieldSpecifierZeroes<AdLibPiece> = {
361388meteorPublish ( CorelibPubSub . adLibPieces , async function ( rundownIds : RundownId [ ] , token : string | undefined ) {
362389 check ( rundownIds , Array )
363390
364- if ( rundownIds . length === 0 ) return null
391+ if ( rundownIds . length === 0 ) {
392+ this . ready ( )
393+ return null
394+ }
365395
366396 const selector : MongoQuery < AdLibPiece > = {
367397 rundownId : { $in : rundownIds } ,
@@ -417,8 +447,14 @@ meteorPublish(
417447 check ( partInstanceIds , Match . Maybe ( Array ) )
418448
419449 // If values were provided, they must have values
420- if ( rundownIds . length === 0 ) return null
421- if ( partInstanceIds && partInstanceIds . length === 0 ) return null
450+ if ( rundownIds . length === 0 ) {
451+ this . ready ( )
452+ return null
453+ }
454+ if ( partInstanceIds && partInstanceIds . length === 0 ) {
455+ this . ready ( )
456+ return null
457+ }
422458
423459 const selector : MongoQuery < PieceInstance > = {
424460 rundownId : { $in : rundownIds } ,
@@ -485,7 +521,10 @@ meteorPublish(
485521 ) {
486522 check ( rundownIds , Array )
487523
488- if ( rundownIds . length === 0 ) return null
524+ if ( rundownIds . length === 0 ) {
525+ this . ready ( )
526+ return null
527+ }
489528
490529 const selector : MongoQuery < PieceInstance > = {
491530 rundownId : { $in : rundownIds } ,
@@ -522,7 +561,10 @@ meteorPublish(
522561 if ( ! peripheralDevice ) throw new Meteor . Error ( `PeripheralDevice "${ deviceId } " not found` )
523562
524563 const studioId = peripheralDevice . studioId
525- if ( ! studioId ) return null
564+ if ( ! studioId ) {
565+ this . ready ( )
566+ return null
567+ }
526568
527569 return ExpectedPlayoutItems . findWithCursor ( { studioId } )
528570 }
@@ -551,7 +593,10 @@ meteorPublish(
551593 async function ( rundownIds : RundownId [ ] , token : string | undefined ) {
552594 check ( rundownIds , Array )
553595
554- if ( rundownIds . length === 0 ) return null
596+ if ( rundownIds . length === 0 ) {
597+ this . ready ( )
598+ return null
599+ }
555600
556601 const selector : MongoQuery < RundownBaselineAdLibItem > = {
557602 rundownId : { $in : rundownIds } ,
@@ -579,7 +624,10 @@ const adlibActionSubFields: MongoFieldSpecifierZeroes<AdLibAction> = {
579624meteorPublish ( CorelibPubSub . adLibActions , async function ( rundownIds : RundownId [ ] , token : string | undefined ) {
580625 check ( rundownIds , Array )
581626
582- if ( rundownIds . length === 0 ) return null
627+ if ( rundownIds . length === 0 ) {
628+ this . ready ( )
629+ return null
630+ }
583631
584632 const selector : MongoQuery < AdLibAction > = {
585633 rundownId : { $in : rundownIds } ,
@@ -618,7 +666,10 @@ meteorPublish(
618666 async function ( rundownIds : RundownId [ ] , token : string | undefined ) {
619667 check ( rundownIds , Array )
620668
621- if ( rundownIds . length === 0 ) return null
669+ if ( rundownIds . length === 0 ) {
670+ this . ready ( )
671+ return null
672+ }
622673
623674 const selector : MongoQuery < RundownBaselineAdLibAction > = {
624675 rundownId : { $in : rundownIds } ,
0 commit comments