ComfyUI Node

TagPipeUpdate

Set one key in a TAGSET without mutating the original

By sugarkwork·Created 2 years ago·Updated 6 months ago· 89
TagPipeUpdate
  • tagsets
  • tagsets
key
val

TagPipeUpdate is the write node of this pack's TAGSET pipe system. It takes a TAGSET in, a key, and a val, and produces a new TAGSET with that key set - without touching the input set. It's the functional-update middle step: bundle values with TagPipeIn, change one of them mid-graph, and hand the result further along.

The mechanism is a copy-then-set, which is the right call for a node graph. The node copies the input dict, assigns tagsets[key] = val, and returns the copy. Your original TAGSET wire stays intact, so anything else reading the upstream set still sees the old value. This is how you build an immutable "update the prompt, keep the metadata" pattern: the modified set flows one way, the pristine set flows another, and neither surprises the other.

Why "immutability" matters here

ComfyUI re-executes nodes as upstream values change, and a node that mutated its input in place would be a quiet footgun - re-running a branch could corrupt a shared value for every consumer. TagPipeUpdate sidesteps that entirely by never mutating. It's the difference between a well-behaved data transform and a stateful mess, and it's why you can safely thread the same TAGSET through several updates in a chain: each step produces a new set, previous steps' outputs remain valid.

Practical use: a shared prompt bundle where one field (say, the camera tag or the seed_tags) gets swapped by a conditional later in the graph. Upstream reads the base set, the swap branch uses TagPipeUpdate to produce a variant, and both streams continue in parallel.

The gotchas

A new key gets created if the key doesn't exist yet - that's a feature for bootstrapping, but also means a typo silently adds positve as a fresh entry while positive stays untouched. And the val replaces wholesale; there's no append or merge mode here. If you need to combine values, do it with TagMerger first and set the merged result.

Install

Same pack, same routine: ComfyUI Manager search "comfyui_tag_filter", or

cd ComfyUI/custom_nodes
git clone https://github.com/sugarkwork/comfyui_tag_fillter

Restart. No dependencies, no models. Small node, one job, and the one thing it does - copy-and-set instead of mutate - is the thing that keeps it safe in real workflows.

Categorytext

Inputs (3)

NameTypeDefaultDescription
tagsetsTAGSET
keySTRING
valSTRING

Outputs (1)

NameTypeDescription
tagsetsTAGSET