ComfyUI Node

Sonder Switch

An N-way router that only runs the branch you pick

By SonderSaid·Created about a month ago·Updated 12 days ago· 30
Sonder Switch
  • branches
  • item
select0

Sonder Switch is the lazy N-way router in the Sonder pack, and "lazy" is the whole point. A normal switch node in ComfyUI routes data but still executes everything upstream - every branch, including the ones you didn't pick. Sonder Switch marks its branch inputs as lazy, which tells the engine to evaluate only the selected branch. Wire a model loader into branch 2, a different one into branch 5, flip the selector, and the unselected loader never runs: no VRAM spent, no disk reads, no wasted seconds.

That matters more the bigger the branches get. The classic pain it solves is a single workflow with several heavy alternatives - an SDXL loader, a Flux loader, an LTX video pipeline - where you only ever want one active. A non-lazy A/B switch was always the workaround, but it loaded everything, and on a 24GB card that's the difference between "switching models" and "switching and then watching it OOM."

How it works

This node uses ComfyUI's newer V3 schema, so you'll only see it on a recent ComfyUI build (older installs keep the rest of the pack but not this one). Its mechanism is the engine's lazy input evaluation plus a fingerprint: if select is a fixed widget value, only that branch is computed; if select is itself wired from upstream, the node fingerprints the linked value so the engine still knows which input to resolve. That's the part that makes it safe to drive the selector from another node - a linked selector can't accidentally evaluate every branch just because the engine can't see the value statically.

Inputs you set:

  • select - zero-based branch index (0 to 31).
  • branches - autogrowing branch inputs, 2 to 32. All branches must resolve to the same type; this is a one-type router.

Output: item, the value from the selected branch. It accepts any type (IMAGE, model, string, whatever), but every branch in a given switch must match.

Install and gotchas

Ships with the pack - ComfyUI Manager search Sonder Editor, or clone https://github.com/SonderSaid/ComfyUI-Sonder-Editor.git into custom_nodes, pip install -r requirements.txt, restart. Since it's V3-schema, keep ComfyUI updated.

Two traps worth knowing. First, "lazy" is an execution guarantee, not a wiring guarantee: if both branches share an upstream node, that shared node still runs (it has to). The laziness skips unselected branch inputs, it can't skip common ancestors. Second, all branches must match types - if you think you're routing a model on one branch and a conditioning on another, the node will refuse to connect. That's by design; Sonder Cluster exists for the mixed-type case.

If you want to verify the laziness actually works before you trust it, the pack ships Sonder Lazy Debug Sleep for exactly that - drop a sleep in each branch and watch which ones pause. It's a test instrument, but for a claim as good as "your unselected model loader doesn't run," testing it once is worth the minute.

CategorySonder/Logic

Inputs (2)

NameTypeDefaultDescription
selectINT00–31Zero-based selected branch index.
branchesCOMFY_AUTOGROW_V3Autogrowing branch inputs. All branches must resolve to the same type.

Outputs (1)

NameTypeDescription
itemCOMFY_MATCHTYPE_V3