Skip to content

Fix table values loading issue in inbound-endpoints#2401

Merged
ChinthakaJ98 merged 1 commit into
wso2:release/mi-4.1.2from
ChinthakaJ98:mi-fix-29
Jul 3, 2026
Merged

Fix table values loading issue in inbound-endpoints#2401
ChinthakaJ98 merged 1 commit into
wso2:release/mi-4.1.2from
ChinthakaJ98:mi-fix-29

Conversation

@ChinthakaJ98

@ChinthakaJ98 ChinthakaJ98 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

This PR will fix the issue wso2/mi-vscode#1079

Summary by CodeRabbit

  • Bug Fixes
    • Improved form editing so object-shaped and nested parameter values load consistently, with expressions normalized for reliable UI display.
    • Refined inbound connector form submission so text content is preserved more accurately and consistently.
    • Fixed array-based attribute serialization to produce cleaner, more predictable saved output for repeated values.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3c1ac33f-55b5-497a-bef0-a2956d47d8e4

📥 Commits

Reviewing files that changed from the base of the PR and between f676037 and 155fbc6.

📒 Files selected for processing (2)
  • workspaces/mi/mi-diagram/src/components/Form/GigaParamManager/ParameterManager.tsx
  • workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/inboundConnectorForm.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • workspaces/mi/mi-diagram/src/components/Form/GigaParamManager/ParameterManager.tsx
  • workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/inboundConnectorForm.tsx

📝 Walkthrough

Walkthrough

This PR updates form parameter handling in two components: edited parameters are normalized before reset, and inbound connector values are extracted and serialized with simplified fallback and array formatting.

Changes

Form Parameter Value Handling

Layer / File(s) Summary
Parameter edit normalization in ParameterManager
workspaces/mi/mi-diagram/src/components/Form/GigaParamManager/ParameterManager.tsx
handleEditParameter clones the parameter, normalizes matching fields with getFieldValue when their input type is not in EXPRESSION_INPUT_TYPES, and resets the form with the normalized value.
Inbound connector value extraction and serialization
workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/inboundConnectorForm.tsx
getParameterValue changes its non-string/non-array fallback to param?.textNode ?? "", and extractProperties now builds array attribute strings with map, JSON.stringify, and join(",").

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only links an issue and omits the required template sections like Purpose, Goals, Approach, tests, and release note. Expand the PR description to follow the template, including Purpose, Goals, Approach, tests, release note, and the required checklists.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the inbound-endpoints table value loading fix reflected in the form value normalization changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
workspaces/mi/mi-diagram/src/components/Form/GigaParamManager/ParameterManager.tsx (1)

122-124: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Preserve expression objects by value shape, not only by input type.

Line 122 relies on a local allowlist, so any missing/new expression-capable inputType will still pass through getFieldValue and lose isExpression/namespaces. Guard the ExpressionFieldValue shape before flattening.

Proposed adjustment
+        const isExpressionFieldValue = (value: unknown): value is ExpressionFieldValue =>
+            typeof value === "object" &&
+            value !== null &&
+            "isExpression" in value &&
+            "value" in value &&
+            "namespaces" in value;
+
         formData?.elements?.forEach((el: any) => {
             const fieldName = el?.value?.name;
             const inputType = el?.value?.inputType;
             if (fieldName && !EXPRESSION_INPUT_TYPES.includes(inputType)
+                && !isExpressionFieldValue(normalized[fieldName])
                 && typeof normalized[fieldName] === 'object' && normalized[fieldName] !== null) {
                 normalized[fieldName] = getFieldValue(normalized[fieldName]);
             }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@workspaces/mi/mi-diagram/src/components/Form/GigaParamManager/ParameterManager.tsx`
around lines 122 - 124, The flattening logic in ParameterManager should not rely
only on EXPRESSION_INPUT_TYPES, because new expression-capable input types can
still be reduced by getFieldValue and lose ExpressionFieldValue metadata. Update
the normalization path in ParameterManager/normalize handling to detect the
object shape first (for example, by checking for expression-specific fields like
isExpression/namespaces) and skip flattening those values, while still
flattening plain nested objects for non-expression fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/inboundConnectorForm.tsx`:
- Around line 209-214: The table value builder in inboundConnectorForm’s
value-mapping logic is manually interpolating propertyName and propertyValue
into a string, which can break when either contains quotes, backslashes, or
newlines. Update the mapping in the value processing block to build the pair
data as arrays/objects and serialize the final payload with JSON.stringify
instead of concatenating string literals. Keep the change localized around the
items mapping and paramFields assignment so the generated table payload stays
valid for all values.

---

Nitpick comments:
In
`@workspaces/mi/mi-diagram/src/components/Form/GigaParamManager/ParameterManager.tsx`:
- Around line 122-124: The flattening logic in ParameterManager should not rely
only on EXPRESSION_INPUT_TYPES, because new expression-capable input types can
still be reduced by getFieldValue and lose ExpressionFieldValue metadata. Update
the normalization path in ParameterManager/normalize handling to detect the
object shape first (for example, by checking for expression-specific fields like
isExpression/namespaces) and skip flattening those values, while still
flattening plain nested objects for non-expression fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a6ac0f20-de7d-44a7-90ed-747d2c1cb6ec

📥 Commits

Reviewing files that changed from the base of the PR and between d223431 and f676037.

📒 Files selected for processing (2)
  • workspaces/mi/mi-diagram/src/components/Form/GigaParamManager/ParameterManager.tsx
  • workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/inboundConnectorForm.tsx

@ChinthakaJ98 ChinthakaJ98 merged commit 01ba16d into wso2:release/mi-4.1.2 Jul 3, 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