ComfyUI Node

SimpleClear

SimpleClear

By jessesep·Created 9 months ago·Updated 2 months ago· 0
SimpleClear
    • status
    clearfalse

    SimpleClear is the pack's one-button reset: it empties the entire variable store. Flip its clear input to true, run it, and every name that any SimpleSet stored this session is gone. In return you get a status string saying exactly what happened - Cleared 3 variable(s) - plus a preview on the node.

    Why does a reset node exist at all? Because the variable store has a leak problem you'll hit once the pack is in real use: variables live for your entire ComfyUI session and belong to no particular workflow. Load a second workflow that reuses a name like seed or ref, and it silently picks up whatever the previous workflow left behind. State you can't see leaks across graphs, and that's precisely the kind of thing that produces confusing outputs. A SimpleClear at the start of a workflow is the cheap insurance - one run and the slate is clean before anything Sets new values.

    How it works. It's a guardrail around _variables.clear(). When clear is false (the default), it does nothing and returns the polite Set clear=True to clear. Flip it to true and it wipes the dictionary, reporting how many variables it removed. That's the whole mechanism.

    The two things that will trip you up:

    • It's all or nothing. There's no per-name delete in this pack. If you want to remove one variable and keep the rest, SimpleClear is the wrong tool - you'll have to re-Set everything you wanted to keep. Plan around that.
    • The toggle doesn't auto-reset. Set clear to true and it stays true, so every subsequent run of the graph clears the store again, which can silently nuke values you meant to keep for the rest of the session. The habit: flip it on, run once to reset, flip it back to false. A workflow that leaves it on is a workflow that keeps erasing its own state.

    It's also worth knowing the store is in-memory anyway. Restarting ComfyUI achieves the same reset with zero effort - SimpleClear is for mid-session cleanups where a restart is overkill.

    When you'd actually use it. Three situations: before a batch run where you want each workflow to start from known-empty state; after debugging, to clear out the junk names your experiments left behind (run SimpleList first to see what's there); and any time a value "spontaneously" changed and you suspect stale state from another graph. It's a one-input, one-output utility - the simplest node in the pack, and arguably the one that prevents the most silent bugs.

    Install. Nothing special, like the rest of the pack - no dependencies, no model downloads.

    cd ComfyUI/custom_nodes
    git clone https://github.com/jessesep/SimpleVariables.git
    

    Restart ComfyUI and search "variable". Drop a SimpleClear at the front of any workflow that reads stored values you need to be confident about, and remember to flip the toggle back off.

    CategorySimpleVariables

    Inputs (1)

    NameTypeDefaultDescription
    clearBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    statusSTRING