From 3d42ae9a5afe023e555fbef54bfc6ef2a5e01cf2 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Thu, 20 Mar 2014 23:59:11 -0700 Subject: [PATCH] Deps: Wrap functions more debuggably --- packages/deps/deps.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/deps/deps.js b/packages/deps/deps.js index 72d318e5fb..9e898eb217 100644 --- a/packages/deps/deps.js +++ b/packages/deps/deps.js @@ -163,7 +163,14 @@ _.extend(Deps.Computation.prototype, { var previousInCompute = inCompute; inCompute = true; try { - self._func(self); + var func = self._func; + if (Meteor.isClient) { + func(self); + } else { + Meteor._noYieldsAllowed(function () { + func(self); + }); + } } finally { setCurrentComputation(previous); inCompute = false; @@ -309,9 +316,7 @@ _.extend(Deps, { throw new Error('Deps.autorun requires a function argument'); constructingComputation = true; - var c = new Deps.Computation(function (c) { - Meteor._noYieldsAllowed(function () { f(c); }); - }, Deps.currentComputation); + var c = new Deps.Computation(f, Deps.currentComputation); if (Deps.active) Deps.onInvalidate(function () {