Skip to content

Commit 9e11916

Browse files
committed
fix: simplify reactive updates for editedEnvironment and editedSecretEnvironment in TaskParamsForm.vue
Signed-off-by: Prachya Saechua <[email protected]>
1 parent 01af6f6 commit 9e11916

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

web/src/components/TaskParamsForm.vue

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -250,36 +250,16 @@ export default {
250250
this.item[field] = v[field];
251251
});
252252
253-
const parsedEnv = JSON.parse(v.environment || '{}');
254-
const parsedSecret = JSON.parse(v.secret || '{}');
255-
256-
// Clear and update editedEnvironment reactively
257-
Object.keys(this.editedEnvironment).forEach((key) => {
258-
this.$delete(this.editedEnvironment, key);
259-
});
260-
Object.keys(parsedEnv).forEach((key) => {
261-
this.$set(this.editedEnvironment, key, parsedEnv[key]);
262-
});
263-
264-
// Clear and update editedSecretEnvironment reactively
265-
Object.keys(this.editedSecretEnvironment).forEach((key) => {
266-
this.$delete(this.editedSecretEnvironment, key);
267-
});
268-
Object.keys(parsedSecret).forEach((key) => {
269-
this.$set(this.editedSecretEnvironment, key, parsedSecret[key]);
270-
});
253+
this.editedEnvironment = JSON.parse(v.environment || '{}');
254+
this.editedSecretEnvironment = JSON.parse(v.secret || '{}');
271255
272256
// Normalize select type variables to ensure they are arrays
273257
if (this.template && this.template.survey_vars) {
274258
this.template.survey_vars.forEach((surveyVar) => {
275259
if (surveyVar.type === 'select' && this.editedEnvironment[surveyVar.name] !== undefined) {
276260
const currentValue = this.editedEnvironment[surveyVar.name];
277261
if (!Array.isArray(currentValue)) {
278-
this.$set(
279-
this.editedEnvironment,
280-
surveyVar.name,
281-
currentValue == null || currentValue === '' ? [] : [currentValue],
282-
);
262+
this.editedEnvironment[surveyVar.name] = currentValue == null || currentValue === '' ? [] : [currentValue];
283263
}
284264
}
285265
});

0 commit comments

Comments
 (0)