Reposted here from: https://github.com/meteor/meteor/issues/5905#event-506509298
I understand that when there is no selector passed or if the _id
is falsey that we don’t want to select any records. But why the implementation of setting the selector to { _id: Random.id() }
? Why not just set it to { _id: false }
or { $and: [{ _id: 1 }, { _id: 2 }] }
or some other selector where we can ensure that no records will be returned? Using Random.id()
will create a new subscription and may cause inadvertent reactive behavior. Also, while the possibility of randomly selecting an existing id may be astronomically slim, it is still a possibility.
Admittedly, my own use case is a very edge case, but I ran into an issue when I was checking subscription.ready()
in a reactive function which then resubscribed to the subscription. This resulted in an endless loop as I’m essentially subscribing to a new random id every time.