Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds fixed-height virtual scrolling to the search-box secondary panel, updates the supporting docs and demos, adjusts dropdown styling for the virtual list layout, and bumps the package version to 3.29.0. ChangesSearch box virtual scrolling
Sequence Diagram(s)sequenceDiagram
participant pcVue as pc.vue
participant secondLevelPanel as TinySearchBoxSecondLevelPanel
participant virtualScroll as useVirtualScroll
participant scrollContainer as virtual scroll container
pcVue->>secondLevelPanel: pass panelMaxHeight
secondLevelPanel->>virtualScroll: initialize with getList and itemHeight
secondLevelPanel->>scrollContainer: bind vsHandleScroll
scrollContainer->>virtualScroll: emit scroll event
virtualScroll-->>secondLevelPanel: vsVisibleItems and offset values
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/search-box/src/components/second-level-panel.vue (1)
402-415: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winNarrow this watcher to the panel identity.
The deep watch on
prevItemwill reset scroll and remeasure on any nested mutation under that object, not just when the active panel changes. Watching the specific identity/type signal here will avoid unnecessary work on large datasets.Suggested change
watch( - () => props.state.prevItem, + () => [props.state.prevItem?.type, props.state.prevItem?.field, props.state.prevItem?.label], () => { vs.vsState.scrollTop = 0 nextTick(() => { if (refs.vsScrollEl) { refs.vsScrollEl.scrollTop = 0 vs.handleScroll({ target: refs.vsScrollEl }) } }) - }, - { deep: true } + } )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/search-box/src/components/second-level-panel.vue` around lines 402 - 415, The watcher in second-level-panel.vue is too broad because it deep-watches props.state.prevItem and will fire on nested mutations instead of only when the active panel changes. Narrow the watch source in the existing watch callback to the panel identity/type signal used by this component, so the reset logic with vs.vsState.scrollTop, refs.vsScrollEl, and vs.handleScroll only runs when the panel actually switches. Remove the deep option if it is no longer needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/search-box/src/components/second-level-panel.vue`:
- Around line 39-40: The highlight fragment loop in second-level-panel.vue uses
the fragment text as the Vue key, which can collide when item.match contains
repeated substrings. Update the v-for on the item.match fragments to use a
unique index-based key instead of text, so repeated matches in the search result
render and patch correctly during virtual scrolling. Locate the span v-for tied
to item.match and adjust the key generation to ensure each fragment is uniquely
identified.
---
Nitpick comments:
In `@packages/search-box/src/components/second-level-panel.vue`:
- Around line 402-415: The watcher in second-level-panel.vue is too broad
because it deep-watches props.state.prevItem and will fire on nested mutations
instead of only when the active panel changes. Narrow the watch source in the
existing watch callback to the panel identity/type signal used by this
component, so the reset logic with vs.vsState.scrollTop, refs.vsScrollEl, and
vs.handleScroll only runs when the panel actually switches. Remove the deep
option if it is no longer needed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9c85bc00-c35d-46f2-b512-a9d6097ea103
📒 Files selected for processing (13)
packages/docs/.vitepress/config.mtspackages/docs/apis/props.mdpackages/docs/examples/virtual-scroll.mdpackages/docs/search-box/virtual-scroll-data.tspackages/docs/search-box/virtual-scroll-options-api.vuepackages/docs/search-box/virtual-scroll.vuepackages/docs/search-box/webdoc/search-box.jspackages/search-box/package.jsonpackages/search-box/src/components/second-level-panel.vuepackages/search-box/src/composables/use-virtual-scroll.tspackages/search-box/src/pc.vuepackages/search-box/theme-saas/index.lesspackages/search-box/theme/index.less
feat:选项支持虚拟滚动
Summary by CodeRabbit
panel-max-heightsupport to better control the visible scrolling area.panel-max-heightaffects rendering.