Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8765352

Browse files
authored
chore: backport dynamic parametersfix#20740 (#20777)
backport#20740 to 2.28
1 parent7beb95f commit8765352

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

‎site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageViewExperimental.tsx‎

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,6 @@ export const WorkspaceParametersPageViewExperimental: FC<
4848
onCancel,
4949
templateVersionId,
5050
})=>{
51-
constautofillByName=Object.fromEntries(
52-
autofillParameters.map((param)=>[param.name,param]),
53-
);
54-
constinitialTouched=parameters.reduce(
55-
(touched,parameter)=>{
56-
if(autofillByName[parameter.name]!==undefined){
57-
touched[parameter.name]=true;
58-
}
59-
returntouched;
60-
},
61-
{}asRecord<string,boolean>,
62-
);
6351
constform=useFormik({
6452
onSubmit,
6553
initialValues:{
@@ -68,7 +56,6 @@ export const WorkspaceParametersPageViewExperimental: FC<
6856
autofillParameters,
6957
),
7058
},
71-
initialTouched,
7259
validationSchema:useValidationSchemaForDynamicParameters(parameters),
7360
enableReinitialize:false,
7461
validateOnChange:true,
@@ -89,28 +76,23 @@ export const WorkspaceParametersPageViewExperimental: FC<
8976
name:parameter.name,
9077
value,
9178
});
92-
form.setFieldTouched(parameter.name,true);
9379
sendDynamicParamsRequest(parameter,value);
9480
};
9581

96-
// Send the changed parameter and all touched parameters to the websocket
9782
constsendDynamicParamsRequest=(
9883
parameter:PreviewParameter,
9984
value:string,
10085
)=>{
10186
constformInputs:Record<string,string>={};
102-
formInputs[parameter.name]=value;
10387
constparameters=form.values.rich_parameter_values??[];
104-
105-
for(const[fieldName,isTouched]ofObject.entries(form.touched)){
106-
if(isTouched&&fieldName!==parameter.name){
107-
constparam=parameters.find((p)=>p.name===fieldName);
108-
if(param?.value){
109-
formInputs[fieldName]=param.value;
110-
}
88+
for(constparamofparameters){
89+
if(param?.name&&param?.value){
90+
formInputs[param.name]=param.value;
11191
}
11292
}
11393

94+
formInputs[parameter.name]=value;
95+
11496
sendMessage(formInputs);
11597
};
11698

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp