Skip to content

Commit cb93d9d

Browse files
Bugfix - JS function "execute" from node crashing the frontend and response is hidden (FlowiseAI#2589)
* Bugfix - Fix crash when executing JS function from node and fix hidden response * add toString() to code executed result * Change height of CodeEditor to make it bigger, but still make the result visible below. --------- Co-authored-by: Henry Heng <[email protected]>
1 parent 5899e50 commit cb93d9d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/ui/src/ui-component/dialog/ExpandTextDialog.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
7878
useEffect(() => {
7979
if (executeCustomFunctionNodeApi.error) {
8080
if (typeof executeCustomFunctionNodeApi.error === 'object' && executeCustomFunctionNodeApi.error?.response?.data) {
81-
setCodeExecutedResult(executeCustomFunctionNodeApi.error?.response?.data)
81+
setCodeExecutedResult(JSON.stringify(executeCustomFunctionNodeApi.error?.response?.data, null, 2))
8282
} else if (typeof executeCustomFunctionNodeApi.error === 'string') {
8383
setCodeExecutedResult(executeCustomFunctionNodeApi.error)
8484
}
@@ -100,15 +100,15 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
100100
borderColor: theme.palette.grey['500'],
101101
borderRadius: '12px',
102102
height: '100%',
103-
maxHeight: languageType === 'js' ? 'calc(100vh - 250px)' : 'calc(100vh - 220px)',
103+
maxHeight: languageType === 'js' ? 'calc(100vh - 330px)' : 'calc(100vh - 220px)',
104104
overflowX: 'hidden',
105105
backgroundColor: 'white'
106106
}}
107107
>
108108
<CodeEditor
109109
disabled={dialogProps.disabled}
110110
value={inputValue}
111-
height={languageType === 'js' ? 'calc(100vh - 250px)' : 'calc(100vh - 220px)'}
111+
height={languageType === 'js' ? 'calc(100vh - 330px)' : 'calc(100vh - 220px)'}
112112
theme={customization.isDarkMode ? 'dark' : 'light'}
113113
lang={languageType}
114114
placeholder={inputParam.placeholder}
@@ -152,7 +152,7 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
152152
<div style={{ marginTop: '15px' }}>
153153
<CodeEditor
154154
disabled={true}
155-
value={codeExecutedResult}
155+
value={codeExecutedResult.toString()}
156156
height='max-content'
157157
theme={customization.isDarkMode ? 'dark' : 'light'}
158158
lang={'js'}

0 commit comments

Comments
 (0)