Skip to content

The open alternative to Salesforce, designed for AI.

Fix code step editor cursor jumping to the end while typing (#27994)

Thomas Trompetteecabffaa8274
diff --git a/packages/twenty-front/src/modules/logic-functions/hooks/useLogicFunctionForm.ts b/packages/twenty-front/src/modules/logic-functions/hooks/useLogicFunctionForm.ts
index 594836901b4..60e737c1e25 100644
--- a/packages/twenty-front/src/modules/logic-functions/hooks/useLogicFunctionForm.ts
+++ b/packages/twenty-front/src/modules/logic-functions/hooks/useLogicFunctionForm.ts
@@ -34,13 +34,19 @@ export const useLogicFunctionForm = ({
value: LogicFunctionFormValues[TKey],
): Promise<InputJsonSchema | undefined> => {
if (key === 'sourceHandlerCode') {
- const inferredJsonSchema = await getInputSchemaFromSourceCode(
- value as LogicFunctionFormValues['sourceHandlerCode'],
- );
+ const sourceHandlerCode =
+ value as LogicFunctionFormValues['sourceHandlerCode'];
+
+ setFormValues((prevState: LogicFunctionFormValues) => ({
+ ...prevState,
+ sourceHandlerCode,
+ }));
+
+ const inferredJsonSchema =
+ await getInputSchemaFromSourceCode(sourceHandlerCode);
setFormValues((prevState: LogicFunctionFormValues) => ({
...prevState,
- sourceHandlerCode: value as string,
toolTriggerSettings: prevState.toolTriggerSettings
? {
...prevState.toolTriggerSettings,