diff --git a/lib/VisibilityCalculator.js b/lib/VisibilityCalculator.js index 92621a36..936284e1 100644 --- a/lib/VisibilityCalculator.js +++ b/lib/VisibilityCalculator.js @@ -69,8 +69,10 @@ module.exports = VisibilityCalculator = /*#__PURE__*/function () { } return async.each(item.contents, function (subitem, cb) { - return _this.processItem(subitem, isVisible === false, data, responseRow, visibilityStructure, prefix, function () { - return _.defer(cb); + return _.defer(function () { + return _this.processItem(subitem, isVisible === false, data, responseRow, visibilityStructure, prefix, function () { + return _.defer(cb); + }); }); }, callback); }; // Always visible if no condition has been set diff --git a/src/VisibilityCalculator.coffee b/src/VisibilityCalculator.coffee index ab140098..3dc830b7 100644 --- a/src/VisibilityCalculator.coffee +++ b/src/VisibilityCalculator.coffee @@ -48,10 +48,11 @@ module.exports = class VisibilityCalculator visibilityStructure[prefix + item._id] = isVisible async.each item.contents, (subitem, cb) => - @processItem(subitem, isVisible == false, data, responseRow, visibilityStructure, prefix, -> _.defer(cb)) + _.defer(() => + @processItem(subitem, isVisible == false, data, responseRow, visibilityStructure, prefix, -> _.defer(cb)) + ) , callback - # Always visible if no condition has been set if forceToInvisible isVisible = false