fix: collapse toolbar will error when hiding tools#1536
fix: collapse toolbar will error when hiding tools#1536hexqi merged 2 commits intoopentiny:developfrom
Conversation
WalkthroughThe rendering logic for toolbar collapse bar items in Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learningspackages/layout/src/composable/useLayout.ts (11)🧬 Code Graph Analysis (1)packages/layout/src/composable/useLayout.ts (1)
🔇 Additional comments (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
【问题描述】
问题一: v2.7 工具栏 collapse 隐藏部分工具时,可能会导致报错,分隔线条可能会导致重复渲染。
问题二: 使用 layoutConfig 全局替换,改变插件的位置,会导致重复渲染。
【问题分析】
问题一:
隐藏时,layoutconfig 仍然没有直接删减掉,使用 layoutConfig 全局替换时,也不会删减掉(注册表会进行深度 merge)
所以,当设置某一个工具栏为 false时:,会得到
getMergeMeta(comp).options中的getMergeMeta(comp)为 undefined,访问.opotions属性导致报错:分隔线仍然重复渲染:
分组的 item 数组全部为时,仍然会进入
v-if="Array.isArray(item)"的 整个大循环,导致empty-line渲染。问题二:
layout 插件默认的 defaultLayout 放置到了默认的 options 里面,会跟用户的 options 进行深度的 merge,从而导致修改位置插件后,会导致重复的渲染。比如插件X从数组 A,移动到了数组B,此时数组A中的插件并X没有消失,同时数组B还新增了插件X。
【解决方案】
问题一:
提前对
collapseBar进行过滤,在注册表无法找到的 id、或者 id 为空的,直接过滤掉。问题二:
在 layout 插件的默认 options 中,移除默认的 layoutConfig。
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit