Skip to content

Conversation

@chilingling
Copy link
Member

@chilingling chilingling commented Oct 24, 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:

Background and solution

What is the current behavior?

从 init 方法中,返回应用实例,支持使用实例进行更多扩展的场景。

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Refactor
    • The init and initPreview functions now return the Vue app instance after mounting, enabling access to the initialized app for further configuration.
@github-actions github-actions bot added the enhancement New feature or request label Oct 24, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

Walkthrough

The init and initPreview functions in the design-core package have been modified to return the Vue app instance after mounting, instead of returning undefined.

Changes

Cohort / File(s) Summary
Return app instance from init functions
packages/design-core/src/init.js, packages/design-core/src/preview/src/main.js
Both functions now return the Vue app instance after mounting, enabling callers to access the app object for further operations

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit hops with apps in hand,
Returning what the code commands.
Init now yields what wasn't there—
Vue instances, fresh and fair!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: return app instance from init functions" directly and accurately reflects the main changes in the changeset. Both modified files (init.js and initPreview in main.js) have been updated to return the Vue app instance after mounting, which is exactly what the title describes. The title is concise, clear, uses specific terminology without vague language, and would effectively communicate the primary change to a teammate reviewing the commit history. The use of "init functions" (plural) appropriately captures that multiple functions are being modified with the same pattern.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 0

🧹 Nitpick comments (1)
packages/design-core/src/preview/src/main.js (1)

33-34: LGTM! Consider adding JSDoc documentation for consistency.

The implementation correctly returns the Vue app instance after mounting, consistent with the init function changes.

Consider adding JSDoc documentation for consistency:

+/** + * Initialize the TinyEngine preview application + * @param {Object} options - Initialization options + * @param {Array|Object} options.registry - Custom registry configuration + * @param {Object} [options.lifeCycles={}] - Lifecycle hooks + * @returns {App} The Vue application instance + */ export const initPreview = ({ registry, lifeCycles = {} }) => {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c27e843 and 517a560.

📒 Files selected for processing (2)
  • packages/design-core/src/init.js (1 hunks)
  • packages/design-core/src/preview/src/main.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/design-core/src/init.js (1)
packages/design-core/src/preview/src/main.js (1)
  • app (28-28)
packages/design-core/src/preview/src/main.js (1)
packages/design-core/src/init.js (1)
  • app (148-148)
⏰ 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)
  • GitHub Check: push-check
🔇 Additional comments (1)
packages/design-core/src/init.js (1)

154-155: Implementation verified—return statement correctly returns Vue app instance after initialization.

Verification confirms no TypeScript definition files exist in packages/design-core, so type definitions do not require updating. The implementation is correct and enables callers to perform additional operations or access app configuration after initialization.

@chilingling chilingling added this to the v2.9.0 milestone Oct 31, 2025
@hexqi hexqi merged commit 67e613f into opentiny:develop Oct 31, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

2 participants