diff --git a/packages/react-meteor-data/useTracker.js b/packages/react-meteor-data/useTracker.js index d1754b2d..dc82bad0 100644 --- a/packages/react-meteor-data/useTracker.js +++ b/packages/react-meteor-data/useTracker.js @@ -66,7 +66,11 @@ else { // console.log('setup deferred subscriptions'); deferredSubscriptions.current.forEach(([name, ...args]) => { const { stop } = Meteor.subscribe(name, ...args); - computation.current.onStop(stop); + // Manually stop the subscriptions when the compotation invalidates, + // as Meteor would do for "regular" subscriptions made during autotrun. + // @todo if the computation then resubscribes to the same publication, + // Meteor doesn't apply the usual "skip unsubscribe / resubscribe" optimisation. + computation.current.onInvalidate(stop); }); deferredSubscriptions.current = null; }