Skip to content

Commit b2731ec

Browse files
fix(ui): mark workflow touched on form builder state changes
1 parent 598fcf8 commit b2731ec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

invokeai/frontend/web/src/features/nodes/store/workflowSlice.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export const workflowSlice = createSlice({
132132
elements: { [rootElement.id]: rootElement },
133133
rootElementId: rootElement.id,
134134
};
135+
state.isTouched = true;
135136
},
136137
formElementAdded: (
137138
state,
@@ -148,36 +149,44 @@ export const workflowSlice = createSlice({
148149
if (isNodeFieldElement(element)) {
149150
state.formFieldInitialValues[element.id] = initialValue;
150151
}
152+
state.isTouched = true;
151153
},
152154
formElementRemoved: (state, action: PayloadAction<{ id: string }>) => {
153155
const { form } = state;
154156
const { id } = action.payload;
155157
removeElement({ form, id });
156158
delete state.formFieldInitialValues[id];
159+
state.isTouched = true;
157160
},
158161
formElementReparented: (state, action: PayloadAction<{ id: string; newParentId: string; index: number }>) => {
159162
const { form } = state;
160163
const { id, newParentId, index } = action.payload;
161164
reparentElement({ form, id, newParentId, index });
165+
state.isTouched = true;
162166
},
163167
formElementHeadingDataChanged: (state, action: FormElementDataChangedAction<HeadingElement>) => {
164168
formElementDataChangedReducer(state, action, isHeadingElement);
169+
state.isTouched = true;
165170
},
166171
formElementTextDataChanged: (state, action: FormElementDataChangedAction<TextElement>) => {
167172
formElementDataChangedReducer(state, action, isTextElement);
173+
state.isTouched = true;
168174
},
169175
formElementNodeFieldDataChanged: (state, action: FormElementDataChangedAction<NodeFieldElement>) => {
170176
formElementDataChangedReducer(state, action, isNodeFieldElement);
177+
state.isTouched = true;
171178
},
172179
formElementContainerDataChanged: (state, action: FormElementDataChangedAction<ContainerElement>) => {
173180
formElementDataChangedReducer(state, action, isContainerElement);
181+
state.isTouched = true;
174182
},
175183
formFieldInitialValuesChanged: (
176184
state,
177185
action: PayloadAction<{ formFieldInitialValues: WorkflowState['formFieldInitialValues'] }>
178186
) => {
179187
const { formFieldInitialValues } = action.payload;
180188
state.formFieldInitialValues = formFieldInitialValues;
189+
state.isTouched = true;
181190
},
182191
},
183192
extraReducers: (builder) => {

0 commit comments

Comments
 (0)