Skip to content

Make parent type selected when fields are selected#1495

Merged
sachiniSam merged 1 commit intowso2:feature/persist-improvementsfrom
sachiniSam:persistImprovements
Feb 19, 2026
Merged

Make parent type selected when fields are selected#1495
sachiniSam merged 1 commit intowso2:feature/persist-improvementsfrom
sachiniSam:persistImprovements

Conversation

@sachiniSam
Copy link
Contributor

@sachiniSam sachiniSam commented Feb 19, 2026

Purpose

$subject
related issue wso2/product-ballerina-integrator#2042

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 selection behavior in the dependent type editor to ensure parent items are automatically marked as selected when child fields are selected, providing more intuitive and consistent selection state management.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

📝 Walkthrough

Walkthrough

A new internal helper function propagateSelectionUpwards is added to traverse and mark parent members as selected when any descendant field is selected. The function is integrated into field toggle and select-all handlers to update selection state in the dependency type editor.

Changes

Cohort / File(s) Summary
Selection Propagation Enhancement
workspaces/ballerina/ballerina-side-panel/src/components/editors/DependentTypeEditor.tsx
Added propagateSelectionUpwards helper function that traverses members and nested types to propagate child field selections upward to parents, with circular reference protection. Integrated into handleToggleField and handleSelectAll to synchronize selection state before UI updates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Selection bubbles up the tree so high,
From children fields to parents in the sky,
A circle guard ensures we don't get stuck,
Toggling and selecting—what good luck! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete. The Purpose section contains only a literal placeholder '$subject' instead of actual content, and nearly all other sections contain only template placeholders without substantive information. Complete the Purpose section with a clear problem statement and any related issue links. Fill in Goals, Approach (with UI details if applicable), User stories, Release notes, Documentation, and Test environment sections with concrete content.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding logic to mark parent types as selected when child fields are selected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@workspaces/ballerina/ballerina-side-panel/src/components/editors/DependentTypeEditor.tsx`:
- Around line 143-147: The comment above the block that sets member.selected is
misleading: replace it with a concise description that the guard checks whether
the member is optional (member.optional !== false) and that we set
member.selected to anyChildSelected so optional parents are selected when any
child is selected and deselected when no children are selected; reference the
symbols member, member.optional, member.selected, and anyChildSelected and
update the comment to reflect that the guard protects required fields
(non-optional) rather than "already-selected" parents.

@sachiniSam sachiniSam merged commit 6426cfd into wso2:feature/persist-improvements Feb 19, 2026
5 of 6 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