fix: preview should not overwrite mainFile#920
fix: preview should not overwrite mainFile#920yy-wow merged 1 commit intoopentiny:refactor/developfrom
Conversation
WalkthroughThe changes in Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (2)packages/design-core/src/preview/src/preview/Preview.vue (2)
Removing the Line range hint While the fix prevents blocks from overwriting the main file, there's no validation to ensure unique panel names among blocks themselves. Consider adding a check to prevent potential overwrites if two blocks have the same file name. Let's verify if there are any duplicate block file names in the codebase: Consider adding this validation before the const blockNames = new Set()
pageCode.forEach(({ panelName }) => {
if (blockNames.has(panelName)) {
console.warn(`Duplicate block name detected: ${panelName}`)
}
blockNames.add(panelName)
})Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
【问题现象】
当页面有区块时,页面预览只看到区块,点击调试模式,看到
Main.vue文件也是区块的方法【问题分析】
区块出码增加了
index: true的配置,assignFiles方法会增加index: true的判断,如果是true,则会将其改成Main.vue主入口文件。关联 issue: #663
关联 PR: #665
【解决方案】
删除区块出码的
index: true配置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
Improvements
Bug Fixes