Skip to content

[BI] Fix config editor issues when updating field values in nested record configurables#1751

Draft
NipunaRanasinghe wants to merge 1 commit intowso2:mainfrom
NipunaRanasinghe:fix-config-editing
Draft

[BI] Fix config editor issues when updating field values in nested record configurables#1751
NipunaRanasinghe wants to merge 1 commit intowso2:mainfrom
NipunaRanasinghe:fix-config-editing

Conversation

@NipunaRanasinghe
Copy link
Contributor

@NipunaRanasinghe NipunaRanasinghe commented Mar 19, 2026

Purpose

$subject.

Partially fixes wso2/product-integrator#116

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

UI Component Development

Specify the reason if following are not followed.

  • Added reusable UI components to the ui-toolkit. Follow the intructions when adding the componenent.
  • Use ui-toolkit components wherever possible. Run npm run storybook from the root directory to view current components.
  • Matches with the native VSCode look and feel.

Manage Icons

Specify the reason if following are not followed.

  • Added Icons to the font-wso2-vscode. Follow the instructions.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • Bug Fixes
    • Improved change detection in the object configurables editor to prevent unnecessary configuration reloads. The component now uses a more efficient mechanism to determine when configuration needs refreshing, eliminating redundant updates that occurred during parent component re-renders. This delivers better performance and responsiveness when working with configurable items.

Copilot AI review requested due to automatic review settings March 19, 2026 05:24
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

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: 5f1dc0ae-e82f-4f61-ba40-1d283f4b2cc5

📥 Commits

Reviewing files that changed from the base of the PR and between 0274e81 and 4ed3c40.

📒 Files selected for processing (1)
  • workspaces/ballerina/ballerina-visualizer/src/views/BI/Configurables/ConfigurableItem/ConfigObjectEditor.tsx

📝 Walkthrough

Walkthrough

A dependency array optimization in ConfigObjectEditor computes a derived typeKey identifier from fileName and typeValue value to prevent unnecessary record configuration reloads during parent re-renders, fixing nested configuration access issues.

Changes

Cohort / File(s) Summary
Dependency Optimization
workspaces/ballerina/ballerina-visualizer/src/views/BI/Configurables/ConfigurableItem/ConfigObjectEditor.tsx
Modified useEffect dependency tracking to use a computed typeKey string instead of direct object references (fileName, typeValue, configValue), preventing unnecessary record configuration reloads triggered by parent component re-renders.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

Through nested burrows, hop with glee! 🐰
One typeKey sets configs free,
No more re-renders cause a shake,
The lazy rabbit's fix to make!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete. Purpose and linked issue are provided, but Goals, Approach, and all other template sections lack substantive content beyond template headers. Fill in Goals explaining how the fix resolves the issue, Approach with implementation details, Automation tests with test coverage, and Documentation/Training/Security/Certification sections with appropriate status or explanation.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change—fixing config editor issues when updating field values in nested record configurables—and directly aligns with the changeset.
Linked Issues check ✅ Passed The code change addresses the inability to enter nested configurations by optimizing the useEffect dependency to prevent unnecessary re-renders that interfere with nested record editing.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the nested record configuration issue. The modification to ConfigObjectEditor's useEffect dependency is directly related to resolving the linked issue.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the ConfigObjectEditor record-config loading effect to avoid unwanted form resets when parent components re-render with new typeValue object references, improving nested record configurable editing.

Changes:

  • Introduces a derived typeKey to make the useEffect dependency stable across re-renders.
  • Updates the useEffect dependency array to trigger loadRecordConfig() only when the file/type changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

loadRecordConfig();
}, [fileName, typeValue, configValue]);
}, [typeKey]);

Comment on lines +449 to +456
// Derive a stable string key so loadRecordConfig only fires when the actual
// type or file changes — not when the parent passes a new typeValue object reference
// on every re-render (which would reset the form mid-edit).
const typeKey = `${fileName}::${String(typeValue?.value)}`;

useEffect(() => {
loadRecordConfig();
}, [fileName, typeValue, configValue]);
}, [typeKey]);
@NipunaRanasinghe NipunaRanasinghe marked this pull request as draft March 19, 2026 06:01
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.

Cannot enter nested configurations in BI

2 participants