Skip to content

Conversation

@aonoa
Copy link
Contributor

@aonoa aonoa commented Nov 17, 2025

Description

fixed: #6906

-->

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • Run the tests with pnpm test.
  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Refactor
    • Updated internal property bindings in the tree component for improved consistency and maintainability. No changes to functionality or user experience.

Signed-off-by: aonoa <1991849113@qq.com>
@changeset-bot
Copy link

changeset-bot bot commented Nov 17, 2025

⚠️ No Changeset found

Latest commit: b749614

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Walkthrough

The Tree component's checkbox binding mechanism is updated from using the checked prop to model-value, addressing issues with default selection and parent-child relationship synchronization. Minor class attribute reordering applied to ChevronRight elements.

Changes

Cohort / File(s) Summary
Tree Component Checkbox Bindings
packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue
Updated Checkbox component bindings from checked prop to model-value for proper v-model synchronization; reordered class attributes on ChevronRight instances

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify that the model-value binding correctly replaces checked prop functionality across all Checkbox instances
  • Confirm that v-model synchronization properly handles parent-child relationship updates and default selection state
  • Test edge cases around default selected states and cascading selection logic

Possibly related PRs

  • fix: 优化VbenTree组件 #6737: Both PRs modify tree.vue selection and checkbox prop bindings, making structural changes to how the Checkbox component interacts with tree state management.

Suggested reviewers

  • anncwb
  • vince292007
  • mynetfan
  • jinmao88

Poem

🐰 A checkbox rebound, from prop to v-model's grace,
Parent and child now dance in the right place,
Default selections bloom, no longer obscure,
The Tree component's bugs we've finally cured! 🌳✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: tree component cannot set a value' directly aligns with the main bug fix objective of enabling proper value setting in the tree component as described in issue #6906.
Description check ✅ Passed The description references the linked issue (#6906) and correctly identifies this as a bug fix. However, several checklist items remain unchecked including tests, code comments, documentation updates, and validation of dependent changes.
Linked Issues check ✅ Passed The code changes (replacing checked prop with model-value binding in Checkbox component) align with fixing the default selection issue in the Tree component reported in issue #6906.
Out of Scope Changes check ✅ Passed All changes to the tree component are focused on fixing the prop binding for Checkbox selection state, which directly addresses the linked issue's reported problems with value setting and selection management.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-6906

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: 0

🧹 Nitpick comments (1)
packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue (1)

307-314: "Select all" checkbox lacks visual state binding.

The checkbox has an @update:model-value handler but no :model-value prop to display its current state. Users cannot see whether all items are selected or not.

Consider adding a computed property to track the "all selected" state and bind it to the checkbox:

       <Checkbox
         v-if="multiple"
+        :model-value="
+          treeValue?.length > 0 &&
+          treeValue?.length === flattenData.filter((item) => !get(item.value, disabledField)).length
+        "
         @click.stop
         @update:model-value="
           (checked: boolean | 'indeterminate') =>
             checked === true ? checkAll() : unCheckAll()
         "
       />
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f09aace and b749614.

📒 Files selected for processing (1)
  • packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-12-09T04:41:58.914Z
Learnt from: mynetfan
Repo: vbenjs/vue-vben-admin PR: 5075
File: packages/effects/common-ui/src/components/api-select/api-select.vue:61-62
Timestamp: 2024-12-09T04:41:58.914Z
Learning: 在文件 `packages/effects/common-ui/src/components/api-select/api-select.vue` 的组件 `ApiSelect` 中,`childrenField` 的默认值设置为空字符串是有意的,因为并非所有组件都使用树形数据。

Applied to files:

  • packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Lint (windows-latest)
  • GitHub Check: Check (ubuntu-latest)
  • GitHub Check: Check (windows-latest)
  • GitHub Check: Test (windows-latest)
  • GitHub Check: Lint (ubuntu-latest)
  • GitHub Check: post-update (windows-latest)
  • GitHub Check: post-update (ubuntu-latest)
🔇 Additional comments (1)
packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue (1)

383-383: Critical fix correctly addresses the selection binding issue.

Changing from :checked to :model-value is essential for Vue 3 two-way binding with the Checkbox component. This resolves the reported issues where default selection couldn't be set and parent-child linkage was broken.

@doraemonxxx
Copy link

doraemonxxx commented Nov 17, 2025

Please accept and merge. thanks

@jinmao88 jinmao88 merged commit b17fec4 into main Nov 23, 2025
12 of 14 checks passed
@jinmao88 jinmao88 deleted the fix-6906 branch November 23, 2025 23:56
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.

Bug: main分支合并PR分支之前都不需要验证吗?reka-ui组件库的Tree组件有bug,1.无法设置默认选择;2.父子无法关联等等

4 participants