Nodes/AsyncOutput/BatchIterator String Collection
ComfyUI Node

BatchIterator String Collection

The BatchIterator family's 'stash this string' node

By teddy1565·Created 5 months ago·Updated 5 months ago· 0
BatchIterator String Collection
    • passthough_output
    incoming_input
    key_id

    BatchIterator String Collection (class BatchIteratorStringCollection) is the "collect" half of the BatchIterator family's gather pattern: each time it runs it appends the incoming string to a list under a key_id, then passes the string through untouched. If you've seen AsyncOutputCollect, this is the same idea with a fresh set of dictionaries - ASYNC_OUTPUT_BATCH_ITERATOR_STORAGE_DATA_DICT instead of the deprecated family's storage - and without the "Deprecated" label on its category.

    You'd reach for it the same way: a loop generates N strings (prompt lines, seeds, filenames), you want to gather all of them and act on the whole set once the loop finishes. Pair it with BatchIteratorStringEmitter (the counter) and BatchIteratorStringCallback (the reader), all sharing one key_id. This is the maintained, less-scary version of the pattern the AsyncOutput family pioneered.

    How it works

    Pure side effect plus passthrough. On each execution it ensures a list exists for key_id, appends incoming_input to it, and returns the input unchanged. IS_CHANGED returns nan, so it always executes - necessary, since the append has to happen every pass regardless of whether the input "looks changed." Like its AsyncOutput cousin, an empty key_id raises an error on purpose so you can't silently misconfigure the memory key.

    The inputs that matter

    • key_id (STRING) - the memory key. Non-empty, and identical across the Collection, Emitter, and Callback you're wiring together.
    • incoming_input (STRING, forced) - the string to stash.

    Output: passthough_output (STRING) - the input echoed back, so the workflow keeps flowing.

    Installing it

    No dependencies, no model downloads. ComfyUI Manager → search "AsyncOutput" → install and restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/teddy1565/ComfyUI-AsyncOutput
    

    It's under AsyncOutput/BatchIterator/String.

    Where people get burned

    Same memory caveats as the whole pack, slightly relaxed: the BatchIterator family has its own global auto-reset defaulting to on (it's a separate flag from the AsyncOutput family's), so unless you turn it off the gathered strings are wiped at the start of each run - which is the correct behavior for a one-run batch loop and wrong for anything meant to survive across runs. And everything still lives in process memory, so a restart empties your collections. The saving grace versus the deprecated family: these dicts are theirs alone, so the two families' state doesn't cross-contaminate.

    CategoryAsyncOutput/BatchIterator/String

    Inputs (2)

    NameTypeDefaultDescription
    incoming_inputSTRING
    key_idSTRING

    Outputs (1)

    NameTypeDescription
    passthough_outputSTRING