diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.json index c9fb20080a..4166e8d750 100644 --- a/packages/twenty-front/package.json +++ b/packages/twenty-front/package.json @@ -46,7 +46,7 @@ "@lingui/core": "^5.1.2", "@lingui/detect-locale": "^5.2.0", "@lingui/react": "^5.1.2", - "@monaco-editor/react": "^4.6.0", + "@monaco-editor/react": "^4.7.0", "@nivo/bar": "^0.99.0", "@nivo/core": "^0.99.0", "@nivo/line": "^0.99.0", diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/HttpRequestExecutionResult.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/HttpRequestExecutionResult.stories.tsx index 475b081ca5..f1fc800a40 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/HttpRequestExecutionResult.stories.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/HttpRequestExecutionResult.stories.tsx @@ -236,8 +236,8 @@ export const NetworkError: Story = { expect(await canvas.findByText('Request Failed')).toBeVisible(); expect(await canvas.findByText('An error occurred')).toBeVisible(); - const codeEditor = await canvas.findByRole('textbox'); - expect(codeEditor).toHaveValue( + const codeEditorValue = await canvas.findByTestId('code-editor-value'); + expect(codeEditorValue).toHaveValue( 'Network connection failed: timeout after 30 seconds', ); }, diff --git a/packages/twenty-ui/package.json b/packages/twenty-ui/package.json index bfde380899..a158459d82 100644 --- a/packages/twenty-ui/package.json +++ b/packages/twenty-ui/package.json @@ -26,7 +26,7 @@ "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@linaria/react": "^6.2.1", - "@monaco-editor/react": "^4.6.0", + "@monaco-editor/react": "^4.7.0", "@sniptt/guards": "^0.2.0", "@tabler/icons-react": "^3.31.0", "date-fns": "^2.30.0", @@ -42,6 +42,9 @@ "twenty-shared": "workspace:*", "zod": "^4.1.11" }, + "peerDependencies": { + "monaco-editor": ">= 0.25.0 < 1" + }, "scripts": { "build": "npx vite build" }, diff --git a/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx b/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx index 01a1dcfb58..78a857ca02 100644 --- a/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx +++ b/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx @@ -133,50 +133,58 @@ export const CodeEditor = ({ ) : ( - { - setMonaco(monaco); - setEditor(editor); + <> + + { + setMonaco(monaco); + setEditor(editor); - monaco.editor.defineTheme( - BASE_CODE_EDITOR_THEME_ID, - getBaseCodeEditorTheme({ - theme, - }), - ); - monaco.editor.setTheme(BASE_CODE_EDITOR_THEME_ID); + monaco.editor.defineTheme( + BASE_CODE_EDITOR_THEME_ID, + getBaseCodeEditorTheme({ + theme, + }), + ); + monaco.editor.setTheme(BASE_CODE_EDITOR_THEME_ID); - onMount?.(editor, monaco); - setModelMarkers(editor, monaco); - }} - onChange={(value) => { - if (isDefined(value)) { - onChange?.(value); + onMount?.(editor, monaco); setModelMarkers(editor, monaco); - } - }} - onValidate={(markers) => { - onValidate?.(markers); - }} - options={{ - formatOnPaste: true, - formatOnType: true, - overviewRulerLanes: 0, - scrollbar: { - vertical: 'hidden', - horizontal: 'hidden', - }, - minimap: { - enabled: false, - }, - ...options, - }} - /> + }} + onChange={(value) => { + if (isDefined(value)) { + onChange?.(value); + setModelMarkers(editor, monaco); + } + }} + onValidate={(markers) => { + onValidate?.(markers); + }} + options={{ + formatOnPaste: true, + formatOnType: true, + overviewRulerLanes: 0, + scrollbar: { + vertical: 'hidden', + horizontal: 'hidden', + }, + minimap: { + enabled: false, + }, + ...options, + }} + /> + ); }; diff --git a/yarn.lock b/yarn.lock index 6987f5083d..7a3c53b0b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11413,27 +11413,25 @@ __metadata: languageName: node linkType: hard -"@monaco-editor/loader@npm:^1.4.0": - version: 1.4.0 - resolution: "@monaco-editor/loader@npm:1.4.0" +"@monaco-editor/loader@npm:^1.5.0": + version: 1.7.0 + resolution: "@monaco-editor/loader@npm:1.7.0" dependencies: state-local: "npm:^1.0.6" - peerDependencies: - monaco-editor: ">= 0.21.0 < 1" - checksum: 10c0/68938350adf2f42363a801d87f5d00c87d397d4cba7041141af10a9216bd35c85209b4723a26d56cb32e68eef61471deda2a450f8892891118fbdce7fa1d987d + checksum: 10c0/1fd3579cb09b669493cf553dfc0723a93483140a44353ce9a739827edfa7b2c6541b254024d15c48176ece749ef666b6d16cce6cf0e4396c7fa1c5a48012d08a languageName: node linkType: hard -"@monaco-editor/react@npm:^4.6.0": - version: 4.6.0 - resolution: "@monaco-editor/react@npm:4.6.0" +"@monaco-editor/react@npm:^4.7.0": + version: 4.7.0 + resolution: "@monaco-editor/react@npm:4.7.0" dependencies: - "@monaco-editor/loader": "npm:^1.4.0" + "@monaco-editor/loader": "npm:^1.5.0" peerDependencies: monaco-editor: ">= 0.25.0 < 1" - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - checksum: 10c0/231e9a9b66a530db326f6732de0ebffcce6b79dcfaf4948923d78b9a3d5e2a04b7a06e1f85bbbca45a5ae15c107a124e4c5c46cabadc20a498fb5f2d05f7f379 + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + checksum: 10c0/a4e91c6eda1a71f5fd23871bd801de435490ccbc43934d23cba65cefe2be7e9d02c9a57c4ef80fc9fe99e4d4deea51e5db19cb4e0ecf3f51818dda0eb9cdbf12 languageName: node linkType: hard @@ -56643,7 +56641,7 @@ __metadata: "@lingui/react": "npm:^5.1.2" "@lingui/swc-plugin": "npm:^5.6.0" "@lingui/vite-plugin": "npm:^5.1.2" - "@monaco-editor/react": "npm:^4.6.0" + "@monaco-editor/react": "npm:^4.7.0" "@nivo/bar": "npm:^0.99.0" "@nivo/core": "npm:^0.99.0" "@nivo/line": "npm:^0.99.0" @@ -57029,7 +57027,7 @@ __metadata: "@emotion/react": "npm:^11.11.1" "@emotion/styled": "npm:^11.11.0" "@linaria/react": "npm:^6.2.1" - "@monaco-editor/react": "npm:^4.6.0" + "@monaco-editor/react": "npm:^4.7.0" "@prettier/sync": "npm:^0.5.2" "@sniptt/guards": "npm:^0.2.0" "@swc/plugin-emotion": "npm:10.0.4" @@ -57057,6 +57055,8 @@ __metadata: vite-plugin-dts: "npm:3.8.1" vite-plugin-svgr: "npm:^4.3.0" zod: "npm:^4.1.11" + peerDependencies: + monaco-editor: ">= 0.25.0 < 1" languageName: unknown linkType: soft