Fix responseEditor form checkbox#1500
Conversation
📝 WalkthroughWalkthroughA single property is added to a form field configuration in ResponseEditor.tsx, introducing a types array to the FLAG-type field that controls the "Make this response reusable" checkbox. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/ResourceForm/ResourceResponse/ResponseEditor.tsx (1)
181-219:⚠️ Potential issue | 🟡 MinorRemove the
console.logdebug statement on line 289 — it exposes the full form dataThe core fix (adding
types: [{fieldType: "FLAG", selected: false}]) is correct and handles both new and edit modes properly. TheCheckBoxEditorcomponent initializes checkbox state fromfield.value, not fromtypes[0].selected. In edit mode whereres.name.valueis a non-empty string (e.g., "OkResponse"), the checkbox will correctly render as checked because the string is truthy. Thevaluetype mismatch concern is not an issue—CheckBoxEditorhandles both boolean and string values via truthiness checks.The only actionable item is the pre-existing
console.log("Add New Response: ", dataValues)on line 289, which logs the entire form submission data to the console. Remove it or replace with a more targeted log.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/ResourceForm/ResourceResponse/ResponseEditor.tsx` around lines 181 - 219, Remove the debug console.log that prints the full form data (the console.log("Add New Response: ", dataValues) call) from ResponseEditor.tsx; locate the submission/handler where dataValues is used (the form submit block that works with newFieldsRef, setNewFields and res.name.value) and either delete that console.log or replace it with a minimal, non-sensitive log (e.g., a success message or a specific field name), ensuring no full form payload is printed to the console.
🧹 Nitpick comments (1)
workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/ResourceForm/ResourceResponse/ResponseEditor.tsx (1)
288-290: Remove debugconsole.logthat leaks full form dataThe
console.logat line 289 dumps the entiredataValuesmap — which includes response body types, media types, header values, and response names — to the browser console in production. This is a pre-existing artifact but should be removed.🧹 Proposed cleanup
const handleOnNewSubmit = (dataValues: FormValues, formImports: FormImports) => { - console.log("Add New Response: ", dataValues); if (isValidResponse(dataValues)) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/ResourceForm/ResourceResponse/ResponseEditor.tsx` around lines 288 - 290, Remove the debugging console.log that prints full form data in handleOnNewSubmit — specifically delete the line logging "Add New Response: " with dataValues so sensitive response details (dataValues) are not leaked to the browser console; ensure the function handleOnNewSubmit continues to call isValidResponse(dataValues) and process formImports normally after the removal.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/ResourceForm/ResourceResponse/ResponseEditor.tsx`:
- Around line 181-219: Remove the debug console.log that prints the full form
data (the console.log("Add New Response: ", dataValues) call) from
ResponseEditor.tsx; locate the submission/handler where dataValues is used (the
form submit block that works with newFieldsRef, setNewFields and res.name.value)
and either delete that console.log or replace it with a minimal, non-sensitive
log (e.g., a success message or a specific field name), ensuring no full form
payload is printed to the console.
---
Nitpick comments:
In
`@workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/ResourceForm/ResourceResponse/ResponseEditor.tsx`:
- Around line 288-290: Remove the debugging console.log that prints full form
data in handleOnNewSubmit — specifically delete the line logging "Add New
Response: " with dataValues so sensitive response details (dataValues) are not
leaked to the browser console; ensure the function handleOnNewSubmit continues
to call isValidResponse(dataValues) and process formImports normally after the
removal.
Purpose
Summary by CodeRabbit