Nodes/Nifty Nodes for ComfyUI/None Input Switch (Eager)
ComfyUI Node

None Input Switch (Eager)

The None switch that runs both branches no matter what

By Stibo·Created 5 months ago·Updated 2 months ago· 9
None Input Switch (Eager)
  • on_exists
  • on_none
  • value
  • output

Every switch family in the Nifty Nodes pack comes in two flavors, and this is the eager one. None Input Switch (Eager) does the same job as its lazy sibling - check whether a value is None, route to on_exists or on_none accordingly - but with one hard guarantee: both branches are always evaluated, whether or not the selected one is used.

What it is

Inputs and output are nearly identical to the lazy version:

  • value - the thing to check for None.
  • on_exists - used when value is not None.
  • on_none - used when value is None.
  • Output: output - the selected branch's value.

The difference is entirely about when the upstream branches execute. Lazy means the loser of the branch selection never runs. Eager means both do, every time.

Why you'd ever want the eager version

That sounds like waste, and for most graphs it is. But eager evaluation earns its keep in specific situations:

  1. Side effects that must happen. If a branch feeds a preview, a logger, a save node, or a cache that some other part of the graph relies on, the lazy node would silently skip it. Eager guarantees the work happens.
  2. Evaluation-order headaches. Lazy nodes ask ComfyUI to decide which branch to run before running anything, and in a gnarly graph that can produce weird "which input did I get" bugs. Eager sidesteps the whole class of problem by just running everything.
  3. You're building a workflow to share. An eager switch behaves identically no matter how the consumer rewires it, so it's a more forgiving default for templates other people will edit.

The cost is real though: if you hang two expensive subgraphs off this node, you pay for both every run, even when you only use one result. That's the bill for determinism.

Installing it

Same pack, same install as everything else:

cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes

or search "Nifty Nodes" in ComfyUI Manager, then restart. No models or extra dependencies.

Gotchas

The decision between lazy and eager is the whole ballgame here, and the default answer is almost always lazy - eager only makes sense when you've actually hit one of the reasons above. A good rule of thumb: start with the lazy version, and only switch to eager when you can point at the specific node that isn't running. Remember that None includes "unconnected" inputs, so a branch you think is inactive may still be evaluated and its upstream nodes executed - that's the feature, but it means memory and time costs even for branches you never read. And as with the rest of this pack, it's built on ComfyUI's newer V3 API - update ComfyUI if the node doesn't show up after install.

Categorynifty/logic

Inputs (3)

NameTypeDefaultDescription
on_existsoptCOMFY_MATCHTYPE_V3Value passed through when 'value' is not None. Both branches are always evaluated.
on_noneoptCOMFY_MATCHTYPE_V3Value passed through when 'value' is None. Both branches are always evaluated.
valueoptCOMFY_MATCHTYPE_V3The value to check. If it is None, on_none is used; otherwise on_exists.

Outputs (1)

NameTypeDescription
outputCOMFY_MATCHTYPE_V3