Skip to content

Commit

Permalink
Prevent stack overflow mWater/mwater-portal#1312
Browse files Browse the repository at this point in the history
  • Loading branch information
grassick committed Aug 16, 2021
1 parent a48e69b commit a588a3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/VisibilityCalculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/VisibilityCalculator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a588a3d

Please sign in to comment.