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

Commit9d10195

Browse files
committed
feat: set initial param values from autofill
1 parent1d798ea commit9d10195

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,30 @@ export const CreateWorkspacePageViewExperimental: FC<
142142
},
143143
});
144144

145+
// On component mount, sends all initial parameter values to the websocket
146+
// (including defaults and autofilled from the url)
147+
// This ensures the backend has the complete initial state of the form,
148+
// which is vital for correctly rendering dynamic UI elements where parameter visibility
149+
// or options might depend on the initial values of other parameters.
150+
consthasInitializedWebsocket=useRef(false);
151+
useEffect(()=>{
152+
if(hasInitializedWebsocket.current)return;
153+
154+
constformValues=form.values.rich_parameter_values;
155+
if(parameters.length>0&&formValues&&formValues.length>0){
156+
constinitialParams:{[k:string]:string}={};
157+
for(constparamofformValues){
158+
if(param.name&&param.value){
159+
initialParams[param.name]=param.value;
160+
}
161+
}
162+
if(Object.keys(initialParams).length>0){
163+
sendMessage(initialParams);
164+
hasInitializedWebsocket.current=true;
165+
}
166+
}
167+
},[parameters,form.values.rich_parameter_values,sendMessage]);
168+
145169
constautofillByName=useMemo(
146170
()=>
147171
Object.fromEntries(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp