feat(ui): add Use Cache and Save To Gallery to the form builder, make them connectable - #9456
Open
Pfannkuchensack wants to merge 2 commits into
Open
Conversation
… them connectable The two node footer toggles were the only node controls that could not be added to a workflow's form, because they are node attributes stored on `node.data` rather than input fields in `node.data.inputs`. Add a `node-setting` form element type for them, with an add/remove button and drag handle in the node footer mirroring how node fields are added. The label is editable, since two nodes' "Use Cache" entries would otherwise be indistinguishable in a form. Also expose the underlying fields as connection targets. `BaseInvocation` already declares `is_intermediate` and `use_cache` as pydantic fields, so they only needed `Input.Any` and, for `is_intermediate`, dropping the `_IsIntermediate` ui_type that prevented a BooleanField output from connecting. The frontend now parses them into invocation templates - required for handles and connection validation - but still filters them out of the node's input list and never creates field instances for them. Their value keeps living on the node, so `buildNodesGraph` is unchanged and no workflow migration is needed. Graph execution applies edge values in `GraphExecutionState.next()`, before the cache is consulted and before the output image is saved. Node attribute fields are only reachable on nodes that render a footer, so connections to them are rejected elsewhere - otherwise the edge would have no handle to attach to and, on batch and generator nodes, no effect at all. When an edge drives a setting, the node's checkbox is dropped and the form's toggle is disabled, since the local value is no longer what the node runs with.
Pfannkuchensack
requested review from
JPPhoto,
blessedcoolant,
dunkeroni and
lstein
as code owners
August 3, 2026 20:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Feature (frontend + backend). Adds the two node footer toggles — Use Cache and Save To Gallery — to the workflow form builder, and makes their underlying fields connectable.
Why
Every other node control can be placed in a workflow's form. These two could not, because they are node attributes: their value lives on
node.data.useCache/node.data.isIntermediate, not innode.data.inputs, so the existingnode-fieldform element cannot address them.How
1. A
node-settingform element (features/nodes/types/workflow.ts)Parallel to
node-field, holding{ nodeId, setting, label }. Added to the form the same way node fields are: a+/−button revealed on hover in the node footer, or by dragging the setting's label into the form. The label is editable on double-click — two nodes' "Use Cache" entries would otherwise be indistinguishable in a form.Rendered as a
Switchto match how BooleanField inputs render. Settings that no longer apply to their node are hidden in view mode and flagged in edit mode;use_cachestays admin-only, mirroring the node footer.2. The fields become connection targets
BaseInvocationalready declares both as ordinary pydantic fields, so the backend change is small: both now declareInput.Any, andis_intermediatedrops itsui_type=_IsIntermediate, which had made it parse as its own field type that no BooleanField output could connect to.The interesting part is that this needs no workflow migration:
node.data.inputsbuildInvocationNodeskips them, andupdateNodederives its allowed keys from therenode.data.useCachebuildNodesGraphstate.edgesand the backend overwrites the literal on resolutionEdge values are applied in
GraphExecutionState.next()before the invocation is handed to the invoker, so a connecteduse_cacheis resolved by the time the cache is consulted, and a connectedis_intermediateby the time the image is saved.3. Guards against edges that would do nothing
The footer hosts the handles, and
useWithFooteronly renders it for executable nodes with a gallery output. Connections to node attribute fields on any other node are rejected — there would be no handle to attach to, andbuildNodesGraphdrops batch and generator nodes entirely.When an edge drives a setting, the node's checkbox is removed (matching how a connected input field renders) and the form's toggle is disabled, since the local value is no longer what the node runs with.
4. Layout
The footer became one row per setting so each connection handle lines up with its own label, following
InputFieldWrapper. This makes affected nodes ~16px taller.UseCacheCheckbox/SaveToGalleryCheckboxare consolidated into oneNodeSettingFooterControl;useIsBatchNodeanduseNodeHasGalleryOutputwere absorbed into shared predicates intypes/invocation.ts.Notes for reviewers
use_cacheis only reachable on nodes with a gallery output. That is pre-existing (useWithFooter = isExecutableNode && hasGalleryOutput) and this PR deliberately does not widen it — the connection guard just matches reality. Happy to change it if that gate is considered a bug.is_intermediateinversion remains. An edge carriesis_intermediate, the UI says "Save To Gallery". Connecting a boolean node means thinking inverted. Fixing that properly means either a dedicated renderer or renaming the backend field tosave_to_gallery; both felt out of scope here.Related Issues / Discussions
QA Instructions
Form builder
+buttons appear next to both settings.+on Use Cache → it appears in the form; the button becomes−.+.Connections
7. Add a Boolean Primitive, drag from its
Valueoutput onto the Use Cache handle on the footer's left edge → the edge connects, and the checkbox disappears (the edge now supplies the value).8. If the setting is also in the form, its toggle is now disabled.
9. Try connecting to a node with no gallery output (e.g. Add Integers) → no handle is offered.
10. Invoke → the connected value is what the node runs with.
Regression
11. Confirm
use_cache/is_intermediatedo not appear in any node's input list.12. Load a workflow saved before this PR → unchanged; no migration warnings.
Merge Plan
Nothing special.
Checklist
What's Newcopy (if doing a release after this PR)