Skip to content

fix(runtime-vapor): pass render args to template-only components#14721

Merged
edison1105 merged 3 commits intominorfrom
edison/fix/templateOnlyComp
Apr 14, 2026
Merged

fix(runtime-vapor): pass render args to template-only components#14721
edison1105 merged 3 commits intominorfrom
edison/fix/templateOnlyComp

Conversation

@edison1105
Copy link
Copy Markdown
Member

@edison1105 edison1105 commented Apr 14, 2026

Summary by CodeRabbit

  • Tests

    • Updated test utilities and infrastructure for improved test setup and execution.
    • Enhanced test cases for production-mode rendering with better cleanup procedures.
  • Refactor

    • Improved render function invocation with consistent error handling throughout the component lifecycle.
    • Added helper to ensure render functions receive proper arguments and maintain execution context consistency.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18e239ad-d8ea-4df7-9054-c8ca771a5853

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch edison/fix/templateOnlyComp

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 14, 2026

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14721
npm i https://pkg.pr.new/@vue/compiler-core@14721
yarn add https://pkg.pr.new/@vue/compiler-core@14721.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14721
npm i https://pkg.pr.new/@vue/compiler-dom@14721
yarn add https://pkg.pr.new/@vue/compiler-dom@14721.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14721
npm i https://pkg.pr.new/@vue/compiler-sfc@14721
yarn add https://pkg.pr.new/@vue/compiler-sfc@14721.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14721
npm i https://pkg.pr.new/@vue/compiler-ssr@14721
yarn add https://pkg.pr.new/@vue/compiler-ssr@14721.tgz

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@14721
npm i https://pkg.pr.new/@vue/compiler-vapor@14721
yarn add https://pkg.pr.new/@vue/compiler-vapor@14721.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14721
npm i https://pkg.pr.new/@vue/reactivity@14721
yarn add https://pkg.pr.new/@vue/reactivity@14721.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14721
npm i https://pkg.pr.new/@vue/runtime-core@14721
yarn add https://pkg.pr.new/@vue/runtime-core@14721.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14721
npm i https://pkg.pr.new/@vue/runtime-dom@14721
yarn add https://pkg.pr.new/@vue/runtime-dom@14721.tgz

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@14721
npm i https://pkg.pr.new/@vue/runtime-vapor@14721
yarn add https://pkg.pr.new/@vue/runtime-vapor@14721.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14721
npm i https://pkg.pr.new/@vue/server-renderer@14721
yarn add https://pkg.pr.new/@vue/server-renderer@14721.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14721
npm i https://pkg.pr.new/@vue/shared@14721
yarn add https://pkg.pr.new/@vue/shared@14721.tgz

vue

pnpm add https://pkg.pr.new/vue@14721
npm i https://pkg.pr.new/vue@14721
yarn add https://pkg.pr.new/vue@14721.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14721
npm i https://pkg.pr.new/@vue/compat@14721
yarn add https://pkg.pr.new/@vue/compat@14721.tgz

commit: 38ed662

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 86.4 kB 30.3 kB 26.6 kB
runtime-dom.global.prod.js 112 kB 42.3 kB 37.9 kB
vue.global.prod.js 172 kB 62.1 kB 55.3 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 51.1 kB 19.9 kB 18.2 kB
createApp 60.2 kB 23.3 kB 21.2 kB
createApp + vaporInteropPlugin 88.6 kB (+73 B) 32.6 kB (+21 B) 29.5 kB (+59 B)
createVaporApp 29.1 kB (+71 B) 11.3 kB (+28 B) 10.4 kB (+33 B)
createSSRApp 64.7 kB 25 kB 22.7 kB
createVaporSSRApp 34.9 kB (+71 B) 13.3 kB (+24 B) 12.2 kB (+25 B)
defineCustomElement 66.7 kB 25.2 kB 22.9 kB
defineVaporCustomElement 36.4 kB (+71 B) 13.5 kB (+26 B) 12.3 kB (+22 B)
overall 75.2 kB 28.6 kB 26 kB

Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
packages/runtime-vapor/__tests__/component.spec.ts (1)

490-507: Preserve prior __DEV__ value when restoring test state.

Line 506 always resets to true; if the suite started with a different value, this leaks global state across tests.

Suggested patch
-  test('should mount component only with template in production mode', () => {
-    __DEV__ = false
+  test('should mount component only with template in production mode', () => {
+    const prevDev = __DEV__
+    __DEV__ = false
     try {
       const { component: Child } = define({
         render() {
           return template('<div> HI </div>', true)()
         },
       })
@@
       const { host } = define({
         setup() {
           return createComponent(Child, null, null, true)
         },
       }).render()

       expect(host.innerHTML).toBe('<div> HI </div>')
     } finally {
-      __DEV__ = true
+      __DEV__ = prevDev
     }
   })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/runtime-vapor/__tests__/component.spec.ts` around lines 490 - 507,
The test currently forces __DEV__ = true in the finally block which can leak
global state; capture the current value before mutating (e.g., const prevDev =
__DEV__), set __DEV__ = false for the test, and in the finally restore with
__DEV__ = prevDev so prior __DEV__ is preserved; update the test surrounding the
try/finally that manipulates __DEV__ accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/runtime-vapor/__tests__/component.spec.ts`:
- Around line 490-507: The test currently forces __DEV__ = true in the finally
block which can leak global state; capture the current value before mutating
(e.g., const prevDev = __DEV__), set __DEV__ = false for the test, and in the
finally restore with __DEV__ = prevDev so prior __DEV__ is preserved; update the
test surrounding the try/finally that manipulates __DEV__ accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 545f730a-ba06-4ef0-a91d-7cf1bc59a4be

📥 Commits

Reviewing files that changed from the base of the PR and between 65379bd and c37eba3.

📒 Files selected for processing (2)
  • packages/runtime-vapor/__tests__/component.spec.ts
  • packages/runtime-vapor/src/component.ts

@edison1105 edison1105 added the scope: vapor related to vapor mode label Apr 14, 2026
@edison1105 edison1105 merged commit 67114e6 into minor Apr 14, 2026
16 of 17 checks passed
@edison1105 edison1105 deleted the edison/fix/templateOnlyComp branch April 14, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: vapor related to vapor mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant