[Feature Request]Help prevent crossing wires from Switch node

OK - proof of concept :slight_smile:
This is in a separate dev instance on my Windows machine with modified switch node with some node.warn debugging to show what's happening

So, if you click on a

  • Rule 0 is checked - could end up being true so we add "pending" to the onward array instead of msg that it normally would be
  • Rule 1 is checked - it's true so msg is added to the onward array as per normal
  • Rule 2 is checked - it's false so null is added to the onward array as per normal
  • Then, all the array items, starting at index 1, are checked for != null and since one is true, then onward[0] is changed from "pending" to null

If b is pressed, it's processed the same as a but output goes to debug 3 of course.

If c is pressed then we get

  • Rule 0 is checked - could end up being true so we add "pending" to the onward array instead of msg that it normally would be
  • Rule 1 is checked - it's false so null is added to the onward array as per normal
  • Rule 2 is checked - it's false so null is added to the onward array as per normal
  • Then, all the array items, starting at index 1, are checked for != null and since all are null then onward[0] is restored from "pending" back to msg

If the switch is arranged with otherwise as the last rule, then output goes to debug 3 as normal without the onward array being manipulated at all