Skip to content

Commit

Permalink
stop deferred inital subscriptions on computation invalidate rather t…
Browse files Browse the repository at this point in the history
…han stop
  • Loading branch information
yched committed Nov 8, 2018
1 parent a2cc120 commit c2e9f28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react-meteor-data/useTracker.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit c2e9f28

Please sign in to comment.