fix: preview ancestor has folder will get plain page#1565
fix: preview ancestor has folder will get plain page#1565hexqi merged 2 commits intoopentiny:developfrom
Conversation
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate 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. 🪧 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 (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/design-core/src/preview/src/preview/usePreviewData.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: gene9831
PR: opentiny/tiny-engine#1041
File: packages/plugins/datasource/src/DataSourceList.vue:138-138
Timestamp: 2025-01-14T10:06:25.508Z
Learning: PR #1041 in opentiny/tiny-engine is specifically for reverting Prettier v3 formatting to v2, without any logical code changes or syntax improvements.
Learnt from: rhlin
PR: opentiny/tiny-engine#1011
File: packages/canvas/render/src/RenderMain.ts:82-88
Timestamp: 2025-01-14T08:50:50.226Z
Learning: For PR #1011, the focus is on resolving conflicts and migrating code, with architectural improvements deferred for future PRs.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/plugins/page/src/Tree.vue:80-101
Timestamp: 2025-01-14T06:42:57.361Z
Learning: The page tree structure in tiny-engine does not have deep nesting scenarios, so recursion depth protection is not required in tree traversal functions.
Learnt from: chilingling
PR: opentiny/tiny-engine#1440
File: packages/plugins/materials/src/composable/useResource.ts:82-84
Timestamp: 2025-05-28T03:58:31.212Z
Learning: In the TinyEngine codebase, there are two different data structures for page information:
1. App schema components tree (appSchemaState.pageTree) uses nested meta structure with page.meta?.id
2. API responses from pagePluginApi.getPageById() return flattened structure with pageInfo.id and pageInfo.occupier directly
The code should use page.meta?.id when working with pageTree data and pageInfo.id when working with API response data.
packages/design-core/src/preview/src/preview/usePreviewData.ts (4)
Learnt from: chilingling
PR: #1440
File: packages/plugins/materials/src/composable/useResource.ts:82-84
Timestamp: 2025-05-28T03:58:31.212Z
Learning: In the TinyEngine codebase, there are two different data structures for page information:
- App schema components tree (appSchemaState.pageTree) uses nested meta structure with page.meta?.id
- API responses from pagePluginApi.getPageById() return flattened structure with pageInfo.id and pageInfo.occupier directly
The code should use page.meta?.id when working with pageTree data and pageInfo.id when working with API response data.
Learnt from: rhlin
PR: #1011
File: packages/canvas/render/src/page-block-function/methods.ts:9-21
Timestamp: 2025-01-14T06:59:23.602Z
Learning: The code in packages/canvas/render/src/page-block-function/methods.ts is migrated code that should not be modified during the migration phase. Error handling improvements can be addressed in future PRs.
Learnt from: gene9831
PR: #1069
File: packages/plugins/page/src/PageGeneral.vue:107-107
Timestamp: 2025-01-24T07:30:38.528Z
Learning: In PageGeneral.vue, pageParentId.value is only used to initialize the oldParentId ref. After initialization, oldParentId is kept in sync with pageSettingState.oldParentId through a watchEffect.
Learnt from: gene9831
PR: #1011
File: packages/plugins/page/src/PageGeneral.vue:166-178
Timestamp: 2025-01-14T06:40:18.223Z
Learning: The page structure data in PageGeneral.vue cannot have circular dependencies due to design constraints.
🔇 Additional comments (1)
packages/design-core/src/preview/src/preview/usePreviewData.ts (1)
80-80: Approve ancestor filtering in usePreviewData.ts – verify preview APIisPageflagThe addition of
(await getPageRecursively(pageId)) .reverse() .filter(item => item.isPage)correctly preserves the root-to-current order while excluding non-page (folder) entries.
• getPageRecursively (lines 63–70) returns an array of IPage objects each carrying an
isPageboolean.
• The pageId branch in usePreviewData.ts (around line 80) rightly applies this filter; the blockId branch is unaffected.Please confirm with the preview service contract that any folder-type items returned will have
isPage: false, ensuring this filter reliably removes them.
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
【问题描述】
使用 url 预览页面时(即非实时预览模式),如果祖先页面有文件夹,则会预览得到空页面。
【问题分析】
如果有文件夹的时候,文件夹出码得到的是空 div。
【问题修复方案】
获取祖先页面的时候,过滤文件夹。
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