Skip to content

Conversation

@leocaan
Copy link
Contributor

@leocaan leocaan commented Jan 28, 2026

  • 假设缺省展开2级,当check 3级节点时,会触发effectWatch重新收缩到2级,并丢失check操作check操作andling.

Description

修复设置default-expanded-level后无法check更低层级节点

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

  • Bug Fixes

    • Improved tree component selection handling to correctly respect disabled items and properly manage values in both single and multiple selection modes.
    • Fixed inconsistent state synchronization between selection states when handling empty selections.
  • Performance

    • Optimized tree expansion behavior to only trigger when data actually changes, reducing unnecessary updates.

✏️ Tip: You can customize this high-level summary in your review settings.

…dates

假设缺省展开2级,当check 3级节点时,会触发effectWatch重新收缩到2级,并丢失check操作check操作andling.
@changeset-bot
Copy link

changeset-bot bot commented Jan 28, 2026

⚠️ No Changeset found

Latest commit: 7d76f3d

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 Jan 28, 2026

📝 Walkthrough

Walkthrough

The tree component's value synchronization and expansion logic have been refactored. Expansion now triggers only when treeData changes (tracked via snapshot). The updateTreeValue function reworked to properly handle modelValue and treeValue parity across single and multiple selection modes, with explicit handling for undefined, empty, and disabled items.

Changes

Cohort / File(s) Summary
Tree Component Update Logic
packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue
Optimized expansion behavior with lastTreeData debouncing; reworked updateTreeValue to manage modelValue/treeValue synchronization across selection modes; added conditional branches for single vs. multiple mode handling; explicit undefined and empty state management.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • anncwb
  • vince292007
  • mynetfan
  • jinmao88

Poem

🐰 A tree needs balance, left and right,
To track its values, shining bright,
With lastTreeData watching near,
Expansions bloom when changes appear,
Single or multiple, the choice is clear! 🌳✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the specific bug being fixed: inability to check nodes deeper than default-expanded-level when that level is set.
Description check ✅ Passed The description includes the bug explanation, identifies it as a bug fix, and all required checklist items are marked complete, though the English description could be more detailed.
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.


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.

@jinmao88
Copy link
Collaborator

如何复现?

@leocaan
Copy link
Contributor Author

leocaan commented Feb 3, 2026

在 playground 中
\views\system\role\modules\form.vue 中,把 修改为1,就能复现

@jinmao88 jinmao88 merged commit 4f1eeb7 into vbenjs:main Feb 6, 2026
12 of 14 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