Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(webv2): restore cleared workflow descriptions

JPPhoto8772ea9c6b2c
diff --git a/invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.test.ts b/invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.test.ts
index 5fbd02c052..e20d65b512 100644
--- a/invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.test.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.test.ts
@@ -120,7 +120,7 @@ describe('Call Saved Workflow dynamic fields', () => {
expect(fields[0]?.fieldTemplate.input).toBe('any');
});
- it('keeps an explicitly cleared child description empty in the parent signature', () => {
+ it('uses the child description after clearing a parent description', () => {
const child = projectGraphReducer(buildChildWorkflow(), {
description: '',
fieldName: 'a',
@@ -130,8 +130,8 @@ describe('Call Saved Workflow dynamic fields', () => {
const fields = getSavedWorkflowDynamicFields(child, templates);
- expect(fields[0]?.description).toBe('');
- expect(fields[0]?.fieldTemplate.description).toBe('');
+ expect(fields[0]?.description).toBe('The a field');
+ expect(fields[0]?.fieldTemplate.description).toBe('The a field');
});
it('preserves compatible dynamic values and resets incompatible values', () => {
@@ -256,7 +256,7 @@ describe('Call Saved Workflow dynamic fields', () => {
});
});
- it('honors explicit presentation overrides even when they match the old generated value', () => {
+ it('honors explicit label overrides while restoring a cleared description', () => {
const callNode = buildInvocationNode(callSavedWorkflowTemplate, { x: 0, y: 0 });
callNode.id = 'call-1';
const initial = getSavedWorkflowDynamicFields(buildChildWorkflow(), templates).map((field) =>
@@ -299,8 +299,8 @@ describe('Call Saved Workflow dynamic fields', () => {
);
const node = refreshed.nodes.find((candidate) => candidate.id === callNode.id);
expect(node?.type === 'invocation' && node.data.inputs[dynamicFieldName('a')]).toMatchObject({
- description: undefined,
- descriptionOverride: true,
+ description: 'New child description',
+ descriptionOverride: false,
label: 'Left Addend',
labelOverride: true,
});
@@ -403,7 +403,7 @@ describe('Call Saved Workflow dynamic fields', () => {
expect(node?.data.inputs[dynamicFieldName('a')]).toMatchObject({ label: 'Custom label', labelOverride: true });
});
- it('refreshes generated descriptions but preserves an explicit cleared description', () => {
+ it('refreshes generated descriptions after clearing an explicit description', () => {
const callNode = buildInvocationNode(callSavedWorkflowTemplate, { x: 0, y: 0 });
callNode.id = 'call-1';
const initialFields = getSavedWorkflowDynamicFields(buildChildWorkflow(), templates);
@@ -446,8 +446,8 @@ describe('Call Saved Workflow dynamic fields', () => {
document = syncCallSavedWorkflowFields(document, callNode.id, changedAgain, []);
node = document.nodes.find((candidate): candidate is WorkflowInvocationNode => candidate.id === callNode.id);
expect(node?.data.inputs[dynamicFieldName('a')]).toMatchObject({
- description: undefined,
- descriptionOverride: true,
+ description: 'Another child description',
+ descriptionOverride: false,
});
});
diff --git a/invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.ts b/invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.ts
index 034f353f28..3a3d97e178 100644
--- a/invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.ts
@@ -243,9 +243,10 @@ export const syncCallSavedWorkflowFields = (
const descriptionOverridden =
previous &&
(previous.descriptionOverride === true ||
- (previousTemplate !== undefined
- ? (previous.description ?? '') !== previousTemplate.description
- : (previous.description ?? '') !== ''));
+ (previous.descriptionOverride === undefined &&
+ (previousTemplate !== undefined
+ ? (previous.description ?? '') !== previousTemplate.description
+ : (previous.description ?? '') !== '')));
const label = labelOverridden && previous ? previous.label : field.label;
const description = descriptionOverridden && previous ? previous.description : field.description;
diff --git a/invokeai/frontend/webv2/src/features/workflow/core/document.test.ts b/invokeai/frontend/webv2/src/features/workflow/core/document.test.ts
index 9ef4eb1697..14d71f54a9 100644
--- a/invokeai/frontend/webv2/src/features/workflow/core/document.test.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/core/document.test.ts
@@ -218,7 +218,7 @@ describe('projectGraphReducer', () => {
next = projectGraphReducer(next, { description: '', fieldName: 'a', nodeId: nodeAId, type: 'setFieldDescription' });
expect(getInstance(next)?.description).toBeUndefined();
- expect(getInstance(next)?.descriptionOverride).toBe(true);
+ expect(getInstance(next)?.descriptionOverride).toBe(false);
});
it('exposing a field twice is a no-op, and form elements reorder', () => {
diff --git a/invokeai/frontend/webv2/src/features/workflow/core/document.ts b/invokeai/frontend/webv2/src/features/workflow/core/document.ts
index b6a51b901d..3816756296 100644
--- a/invokeai/frontend/webv2/src/features/workflow/core/document.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/core/document.ts
@@ -648,7 +648,7 @@ const applyProjectGraphAction = (document: ProjectGraphState, action: ProjectGra
return setFieldInstance(document, action.nodeId, action.fieldName, (instance) => ({
...instance,
description: action.description || undefined,
- descriptionOverride: true,
+ descriptionOverride: action.description !== '',
}));
}
case 'setFieldSeedMode': {