8000 fix: send the last user modified param and all touched params to the … · coder/coder@b93d804 · GitHub
[go: up one dir, main page]

Skip to content

Commit b93d804

Browse files
committed
fix: send the last user modified param and all touched params to the server
1 parent ec14f9d commit b93d804

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,23 @@ export const CreateWorkspacePageViewExperimental: FC<
213213
parameters,
214214
]);
215215

216+
// send the last user modified parameter and all touched parameters to the websocket
216217
const sendDynamicParamsRequest = (
217218
parameter: PreviewParameter,
218219
value: string,
219220
) => {
220221
const formInputs: { [k: string]: string } = {};
221222
formInputs[parameter.name] = value;
223+
const parameters = form.values.rich_parameter_values ?? [];
224+
225+
for (const [fieldName, isTouched] of Object.entries(form.touched)) {
226+
if (isTouched && fieldName !== parameter.name) {
227+
const param = parameters.find(p => p.name === fieldName);
228+
if (param?.value) {
229+
formInputs[fieldName] = param.value;
230+
}
231+
}
232+
}
222233

223234
sendMessage(formInputs);
224235
};
@@ -233,6 +244,7 @@ export const CreateWorkspacePageViewExperimental: FC<
233244
name: parameter.name,
234245
value,
235246
});
247+
form.setFieldTouched(parameter.name, true);
236248
sendDynamicParamsRequest(parameter, value);
237249
},
238250
500,
@@ -250,6 +262,7 @@ export const CreateWorkspacePageViewExperimental: FC<
250262
name: parameter.name,
251263
value,
252264
});
265+
form.setFieldTouched(parameter.name, true);
253266
sendDynamicParamsRequest(parameter, value);
254267
}
255268
};

0 commit comments

Comments
 (0)
0