-
Notifications
You must be signed in to change notification settings - Fork 454
fix(block-refresh): block not refresh when curd & block deploy fail in second time #1080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis pull request introduces modifications across multiple files in the block management system. The changes primarily focus on enhancing category and block list handling, introducing new reactive state management, and improving the control flow for block-related operations. The modifications streamline how categories are processed, update block lists more efficiently, and ensure proper state synchronization when performing actions like adding or publishing blocks. Changes
Sequence DiagramsequenceDiagram
participant User
participant BlockConfig
participant BlockSetting
participant BlockList
User->>BlockConfig: Select Category/Group
BlockConfig->>BlockSetting: setCurrentCategory()
BlockSetting->>BlockList: updateBlockList()
BlockList-->>User: Refresh Block List
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (3)
packages/plugins/block/src/js/blockSetting.jsx (3)
57-57: Consider initializing currentCategory with null instead of empty string.An empty string as the initial value might not clearly represent "no category selected" state. Using
nullwould be more semantically correct for representing an unselected state.-const currentCategory = ref('') +const currentCategory = ref(null)
280-282: Add validation in setCurrentCategory.The
setCurrentCategoryfunction directly sets the value without any validation. Consider adding type checking and validation to ensure data consistency.export const setCurrentCategory = (categoryId) => { + if (categoryId !== null && typeof categoryId !== 'string' && typeof categoryId !== 'number') { + console.warn('Invalid category ID type. Expected string, number, or null.') + return + } currentCategory.value = categoryId }
369-369: Cache the app ID to avoid repeated API calls.The
getAppIdfunction is called frequently throughout the code. Consider caching the result to improve performance.+let cachedAppId = null const getAppId = () => { + if (cachedAppId) return cachedAppId + cachedAppId = getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id + return cachedAppId }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
packages/common/component/BlockHistoryList.vue(1 hunks)packages/plugins/block/src/BlockConfig.vue(4 hunks)packages/plugins/block/src/Main.vue(2 hunks)packages/plugins/block/src/js/blockSetting.jsx(9 hunks)packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: push-check
🔇 Additional comments (5)
packages/common/component/BlockHistoryList.vue (1)
2-2: LGTM! Good addition of row identifier.Adding the
row-idattribute improves the grid's data management by providing unique row identification.packages/plugins/block/src/BlockConfig.vue (3)
41-41: LGTM! Good dynamic attribute binding.The
multipleattribute is correctly bound to the result ofshouldReplaceCategoryWithGroup(), allowing flexible selection behavior.
170-175: LGTM! Improved category initialization logic.The conditional logic properly handles both group and category scenarios:
- For groups: Maps group IDs to an array
- For categories: Uses the first category ID
246-249: LGTM! Enhanced category change handling.The changes improve the category update logic by:
- Dynamically selecting the correct ID key
- Supporting both single and array values for categories
packages/plugins/block/src/Main.vue (1)
351-352: LGTM! Well-structured refactoring.The category change handling has been simplified and modularized by:
- Moving the logic to a dedicated
setCurrentCategoryfunction- Separating the concerns of category setting and list updating
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
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
New Features
Bug Fixes
Refactor