Gate Switch (NH)
A valve that blocks the branch behind it, not just the data
- input
- output
Sometimes "turn this off" should mean "stop doing the work," not "let the data through and ignore it." That's the whole point of Gate Switch (NH): a boolean enabled decides whether the input passes through, and when it's off, the node doesn't just drop the data - it blocks execution of everything downstream.
This is a different species from a mute or a bypass, and it matters more than people expect. A bypassed node in ComfyUI is skipped, sure, but a gate lets you make that decision at runtime from another node's output, while a manual mute is something you flip by hand before running.
How it works
- input - any type (the
*wildcard). Images, models, latents, whatever. - enabled - a BOOLEAN. True: the input passes straight through
output. False: the output is an ExecutionBlocker signal.
That blocker is the star. ComfyUI sees it and refuses to execute anything downstream of that socket. So if you gate the "heavy upscale" branch of a workflow and flip the gate off, the upscaler - and everything after it - simply never runs. You save seconds-to-minutes of compute per image, and you do it from a boolean that can itself come from a Compare (NH), a Counter (NH), or a Boolean Switch (NH) at the top of the graph.
The input is lazy too, so when the gate is closed ComfyUI doesn't even evaluate the upstream branch feeding it. Gate a whole expensive chain and close it - the chain's cost is zero.
When to reach for it
- A conditional refinement pass: "only run the detailer if
is_doneis false." - An optional upscale or img2img stage you want to switch on the fly without editing the graph.
- Building a workflow with modes - a master switch that turns whole sections of compute off.
The honest contrast: if you just want a node to not fire this run, mute or bypass it by hand - that's simpler. The gate earns its place when the decision is automatic, made by the graph itself. For that job it's the cleanest tool in the pack.
One caveat: a blocked output feeding a node that doesn't handle the blocker gracefully can look like a silent failure - the downstream node just sits there doing nothing with no error. That's the intended behavior, but when you're debugging, check whether the gate was closed before assuming the pipeline broke.
Installing
Part of NH-Nodes, one-time install:
cd ComfyUI/custom_nodes
git clone https://github.com/jetthuangai/NH-Nodes.git
cd NH-Nodes
pip install -r requirements.txt
Or search NH-Nodes in ComfyUI Manager and restart. No models, no downloads.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input | * | — | |
| enabled | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |