Skip to content

Comments

Fix variable creation in helper pane#1543

Merged
kanushka merged 1 commit intowso2:release/bi-1.8.xfrom
senithkay:fix-helper-variable-creation
Feb 24, 2026
Merged

Fix variable creation in helper pane#1543
kanushka merged 1 commit intowso2:release/bi-1.8.xfrom
senithkay:fix-helper-variable-creation

Conversation

@senithkay
Copy link
Contributor

@senithkay senithkay commented Feb 24, 2026

Purpose

When navigating through Expression Helper → Variables → New Variable, the extension crashes instead of allowing users to create a new variable.

The root cause was an incorrect node template property configuration in the form definition for the "New Variable" flow. Due to this misconfiguration, the form renderer fails while resolving required template metadata, leading to a runtime exception and extension crash.

This directly impacts usability, as users are unable to define new variables through the expression helper workflow.

Resolves wso2/product-ballerina-integrator#2528


Goals

  • Fix the incorrect node template property used in the "New Variable" form.
  • Prevent runtime crashes when accessing Expression Helper → Variables → New Variable.
  • Restore the expected variable creation workflow.

Approach

  • Identified the incorrect node template property in the form configuration for the variable creation flow.
  • Corrected the template property mapping to align with the expected schema used by the form renderer.
  • Ensured the required data (types definition) are properly passed to the node template.

Summary by CodeRabbit

  • Refactor
    • Internal optimization to variable type definition structure.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebf8a66 and 110ade3.

📒 Files selected for processing (1)
  • workspaces/ballerina/ballerina-visualizer/src/views/BI/HelperPaneNew/Views/Variables.tsx

📝 Walkthrough

Walkthrough

The getTypeDef() helper function in the Variables component is removed and replaced with an inline type definition. The structure shifts from a valueType property to a types array, while preserving all other metadata, values, and configuration properties for the Variable node's Type field.

Changes

Cohort / File(s) Summary
Variables Component Refactoring
workspaces/ballerina/ballerina-visualizer/src/views/BI/HelperPaneNew/Views/Variables.tsx
Removed getTypeDef() helper function and inlined its logic. Changed type property structure from valueType: "TYPE" to types: [{ fieldType: "TYPE", selected: false }]. All metadata, values, and configuration options remain unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A helper went away one day,
Its logic inlined in every way,
Variables now declare their type,
With structures fresh and code more ripe,
No crashes when the configs play! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title "Fix variable creation in helper pane" clearly and concisely describes the main change - fixing a bug preventing variable creation in the helper pane component.
Description check ✅ Passed The description covers Purpose (with linked issue), Goals, and Approach sections, providing sufficient context for the bug fix, though some template sections like testing and security are not completed.
Linked Issues check ✅ Passed The code changes directly address issue #2528 by fixing the node template property configuration that was causing the extension crash during variable creation.
Out of Scope Changes check ✅ Passed All changes are focused on fixing the variable creation workflow in the helper pane by replacing the getTypeDef() helper with an inline type definition, directly aligned with the linked issue requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kanushka kanushka merged commit 7c44bac into wso2:release/bi-1.8.x Feb 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants