Skip to content

feat: the blocks categories and groups merged by default#1038

Merged
hexqi merged 1 commit intoopentiny:refactor/developfrom
gene9831:feat/enable-mergeCategoriesAndGroups
Jan 14, 2025
Merged

feat: the blocks categories and groups merged by default#1038
hexqi merged 1 commit intoopentiny:refactor/developfrom
gene9831:feat/enable-mergeCategoriesAndGroups

Conversation

@gene9831
Copy link
Collaborator

@gene9831 gene9831 commented Jan 14, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe: Feature enabled by default

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

默认开启区块的合并分类和分组功能

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Configuration Update
    • Modified Block plugin settings to merge categories and groups
    • Updated plugin configuration to improve organizational behavior

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2025

Walkthrough

This pull request modifies the configuration of the Block plugin in two files. In designer-demo/registry.js, the plugins array is updated to include an options object for the Block plugin, specifically setting mergeCategoriesAndGroups to true. Simultaneously, in packages/plugins/block/index.js, the default export's mergeCategoriesAndGroups option is changed from false to true, indicating a configuration change in how categories and groups are handled.

Changes

File Change Summary
designer-demo/registry.js Modified plugins array to include Block plugin with new options object
packages/plugins/block/index.js Updated mergeCategoriesAndGroups option from false to true

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • hexqi

Poem

🐰 Blocks and plugins dance with glee,
Categories merge, now wild and free!
Configuration shifts with a hop,
From false to true, we make it pop!
A rabbit's code leap of delight! 🚀

Finishing Touches

  • 📝 Generate Docstrings (Beta)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8295c3f and 38c8f31.

📒 Files selected for processing (2)
  • designer-demo/registry.js (1 hunks)
  • packages/plugins/block/index.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (2)
designer-demo/registry.js (2)

101-114: LGTM: Plugin array reformatting improves readability.

The reformatting of the plugins array with one plugin per line improves code readability.


105-105: Simplify redundant configuration.

Since mergeCategoriesAndGroups is now true by default in the Block plugin, this explicit configuration is redundant:

-    [Block, { options: { ...Block.options, mergeCategoriesAndGroups: true } }],
+    Block,

Additionally, spreading the options (...Block.options) and then overriding mergeCategoriesAndGroups could mask other important options. If you need to keep this configuration explicit for clarity:

-    [Block, { options: { ...Block.options, mergeCategoriesAndGroups: true } }],
+    [Block, { options: { mergeCategoriesAndGroups: true } }],

Let's check if there are other options that might be affected:

✅ Verification successful

Confirmed: Configuration can be simplified.

The explicit configuration of mergeCategoriesAndGroups: true is redundant since it matches the default value. Additionally, spreading Block.options is unnecessary as there are no other custom options being set. You can safely simplify this to:

-    [Block, { options: { ...Block.options, mergeCategoriesAndGroups: true } }],
+    Block,
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for Block.options usage
ast-grep --pattern 'Block.options' -l js,ts,vue

Length of output: 166


Script:

#!/bin/bash
# Search for Block.options with correct language parameters
for lang in js ts vue; do
  echo "=== Searching in ${lang} files ==="
  ast-grep --pattern 'Block.options' -l "$lang" 2>/dev/null
done

# Search for Block-related configurations
echo -e "\n=== Searching Block configurations ==="
rg "Block.*options" -A 2 -B 2

# Search for Block plugin imports and usage
echo -e "\n=== Searching Block imports and usage ==="
rg "(?:import.*Block|require.*Block)" -A 2

Length of output: 51338

@gene9831 gene9831 changed the title chore: the blocks categories and groups merged by default feat: the blocks categories and groups merged by default Jan 14, 2025
@github-actions github-actions bot added the enhancement New feature or request label Jan 14, 2025
@hexqi hexqi merged commit 1c58c2f into opentiny:refactor/develop Jan 14, 2025
4 checks passed
@gene9831 gene9831 deleted the feat/enable-mergeCategoriesAndGroups branch February 8, 2025 06:17
@coderabbitai coderabbitai bot mentioned this pull request Jun 27, 2025
14 tasks
This was referenced Jul 14, 2025
@coderabbitai coderabbitai bot mentioned this pull request Sep 2, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants