diff --git a/app/imports/api/engine/computation/computeComputation/computeToggles.js b/app/imports/api/engine/computation/computeComputation/computeToggles.js index 657305d6..a39e8dc4 100644 --- a/app/imports/api/engine/computation/computeComputation/computeToggles.js +++ b/app/imports/api/engine/computation/computeComputation/computeToggles.js @@ -5,8 +5,26 @@ export default function evaluateToggles(computation, node) { if (!toggles) return; toggles.forEach(toggle => { if ( - (!toggle.enabled && !toggle.disabled && toggle.condition && !toggle.condition.value) - || (toggle.disabled) + ( + // Toggle isn't set to constantly enabled or disabled + !toggle.enabled && + !toggle.disabled && + // Toggle is not disabled by another toggle targeting it + // Ancestor toggles would've handled this child anyway, + // and tag targeted toggles break the link + !toggle.deactivatedByToggle && + !toggle.deactivatedByAncestor && + // Toggle has a condition with a falsy value + toggle.condition && + !toggle.condition.value + ) + || ( + // Toggle is disabled manually + toggle.disabled && + // Toggle isn't deactivated by something else + !toggle.deactivatedByToggle && + !toggle.deactivatedByAncestor + ) ) { prop.inactive = true; prop.deactivatedByToggle = true;