fix(ui): hide workflow and gallery checkboxes on image primitive

This node doesn't actually *save* the image, so these checkboxes do nothing on it.
This commit is contained in:
psychedelicious 2023-09-23 08:53:39 +10:00
parent e02af8f518
commit 4d01b5c0f2
2 changed files with 7 additions and 3 deletions

View File

@ -25,8 +25,8 @@ const InvocationNodeFooter = ({ nodeId }: Props) => {
justifyContent: 'space-between', justifyContent: 'space-between',
}} }}
> >
{hasImageOutput && <EmbedWorkflowCheckbox nodeId={nodeId} />}
<UseCacheCheckbox nodeId={nodeId} /> <UseCacheCheckbox nodeId={nodeId} />
{hasImageOutput && <EmbedWorkflowCheckbox nodeId={nodeId} />}
{hasImageOutput && <SaveToGalleryCheckbox nodeId={nodeId} />} {hasImageOutput && <SaveToGalleryCheckbox nodeId={nodeId} />}
</Flex> </Flex>
); );

View File

@ -17,8 +17,12 @@ export const useHasImageOutput = (nodeId: string) => {
if (!isInvocationNode(node)) { if (!isInvocationNode(node)) {
return false; return false;
} }
return some(node.data.outputs, (output) => return some(
IMAGE_FIELDS.includes(output.type) node.data.outputs,
(output) =>
IMAGE_FIELDS.includes(output.type) &&
// the image primitive node does not actually save the image, do not show the image-saving checkboxes
node.data.type !== 'image'
); );
}, },
defaultSelectorOptions defaultSelectorOptions