Skip to content

fix: modify the problem of lazy load root node not triggering in tree-menu component vue3#4242

Open
James-9696 wants to merge 1 commit into
opentiny:devfrom
James-9696:fix-tree-menu-problem
Open

fix: modify the problem of lazy load root node not triggering in tree-menu component vue3#4242
James-9696 wants to merge 1 commit into
opentiny:devfrom
James-9696:fix-tree-menu-problem

Conversation

@James-9696

@James-9696 James-9696 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:
    修复treeMenu组件,Vue3 Lazy Load 根节点不触发问题

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Tree menus now respect lazy-loading settings during startup, preventing data from loading too early and keeping menu expansion behavior on demand.

@github-actions github-actions Bot added the bug Something isn't working label Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 95114ad3-d589-401a-86bb-8b778c3034b2

📥 Commits

Reviewing files that changed from the base of the PR and between 46d9cdd and e33e4d7.

📒 Files selected for processing (1)
  • packages/renderless/src/tree-menu/index.ts

Walkthrough

The initData function in the tree-menu renderless module now returns early when props.lazy is truthy, bypassing the existing logic that populates state.data from props.data or fetches menu data via service.getMenuDataSync() followed by api.setMenuKey(...).

Changes

Lazy Tree-Menu Initialization

Layer / File(s) Summary
Early return for lazy loading
packages/renderless/src/tree-menu/index.ts
initData now checks props.lazy and returns immediately, skipping the props.data assignment and service.getMenuDataSync()/api.setMenuKey fetch logic.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

A hop, a skip, a lazy switch,
No fetch, no key, no data glitch. 🐇
When lazy's true, I pause and wait,
Short-circuit joy, a tidy fate!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the bug fix for Vue 3 tree-menu lazy loading not triggering on the root node.
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant