JoyLTX Any Switch (lazy A/B)
A lazy A/B switch that only runs the branch you picked
- off_path
- on_path
- value
ComfyUI's stock switches are dumb valves: they route whatever you feed them, but everything behind them still executes. That matters a lot on the JoyLTX canvases, where each branch might be a full model loader. Load two DiTs into one workflow and every run loads both, even the one you're not using - which on a 24 GB card is how you OOM before the sampler even starts. JoyLTX Any Switch is the lazy version: only the branch the boolean selects is ever executed. The other loader never loads, never occupies VRAM, doesn't even run its load function.
It's a two-input A/B switch, not the "first non-null fallback" kind. The one input you actually touch is use_on (a BOOLEAN, wired rather than typed - the node forces it to be a connected input). When it's true, the node passes on_path through as value; when false, it passes off_path. Both inputs are wildcard * type, so you can switch a MODEL, a LATENT, a CONDITIONING - anything.
The lazy part is the point. ComfyUI asks a node which inputs it wants computed before running it, and this node answers with only the selected one. So you can park a GGUF loader on one side and a native loader on the other and flip between them by dragging a Primitive Boolean around - a cheap way to A/B two model files without rebuilding the graph. The flip side: because only the selected branch runs, the unselected input arrives as nothing, not as a value. Pick the branch you never wired and the node raises "the selected input is not connected," which is the one real gotcha. If you're switching between two things, connect both before you queue.
A practical note: lazy switches are the mechanism ComfyUI uses to avoid wasted work, but a node that always asks for only one input can play badly with caching if you're not careful about what feeds it. Keep the use_on boolean driven by a fixed Primitive rather than something random per run, or you'll be fighting the executor for no benefit.
It ships with the rest of the JoyLTX25 pack - install that and the node is there, no extra dependencies. On the Take and Multishot canvases it's the clean way to keep two prompt sources or two loader paths in one workflow and pick which is live at queue time. It won't change your renders; it just keeps the thing you're not using from costing you.
If all you need is "pick whichever input happens to be connected," reach for a fallback switch like rgthree's Any Switch instead. This one is for when you have a deliberate either/or and you want the dead side to stay dead.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| use_on | BOOLEAN | — | |
| off_pathopt | * | — | |
| on_pathopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | * | — |