Skip to content

Conversation

@edison1105
Copy link
Member

@edison1105 edison1105 commented May 29, 2025

Playground with this PR

foo is a forwarded slot, it is executed, the currentInstance in createSlot is the instance of Comp, but it should be the instance of Comp1.

  const n2 = _createComponent(Comp, null, {
    "foo": () => { 
      const n0 = _createSlot("foo", null) 
      return n0
    }
  }, true)

Therefore, we need to preserve the current component's instance for forwarded slots and use it in createSlot, similar to how withCtx works in VDOM slots. With this PR, the compiled code changes to:

  const _createForwardedSlot = _forwardedSlotCreator()
  const n2 = _createComponent(Comp, null, {
    "foo": () => {
      const n0 = _createForwardedSlot("foo", null)
      return n0
    }
  }, true)

Inside the forwardedSlotCreator, the currentInstance is retained and a function is returned, which calls createSlot and passes the retained instance.

Note

This PR includes #13669

@netlify
Copy link

netlify bot commented May 29, 2025

Deploy Preview for vapor-repl ready!

Name Link
🔨 Latest commit 748686a
🔍 Latest deploy log https://app.netlify.com/projects/vapor-repl/deploys/6854fe2e9bdf2400084357f4
😎 Deploy Preview https://deploy-preview-13408--vapor-repl.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented May 29, 2025

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.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch edison/feat/fowardedSlots

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 29, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13408

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13408

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13408

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13408

@vue/compiler-vapor

npm i https://pkg.pr.new/@vue/compiler-vapor@13408

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13408

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13408

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13408

@vue/runtime-vapor

npm i https://pkg.pr.new/@vue/runtime-vapor@13408

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13408

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13408

vue

npm i https://pkg.pr.new/vue@13408

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13408

commit: eb8f270

@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch from 340d140 to 1854562 Compare May 29, 2025 13:56
@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch 2 times, most recently from b5f3287 to 1b849a3 Compare May 30, 2025 01:26
@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch from 1b849a3 to c23d635 Compare May 30, 2025 01:41
@edison1105 edison1105 marked this pull request as ready for review May 30, 2025 02:12
@edison1105 edison1105 added the scope: vapor related to vapor mode label May 30, 2025
@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch from 4565cf0 to 68577ca Compare May 30, 2025 09:10
@edison1105 edison1105 marked this pull request as draft May 30, 2025 09:11
@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch from 68577ca to dcf927f Compare May 30, 2025 09:12
@edison1105 edison1105 changed the title feat(compiler-vapor): add support for forwarded slots feat(vapor): forwarded slots May 30, 2025
@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch 6 times, most recently from bd32ec4 to 8df4184 Compare June 12, 2025 03:18
@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch 2 times, most recently from 8aca259 to 385c21e Compare June 12, 2025 06:59
@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch from 385c21e to 7cfec7f Compare June 12, 2025 07:17
@edison1105 edison1105 marked this pull request as ready for review June 12, 2025 08:00
@github-actions
Copy link

github-actions bot commented Jul 16, 2025

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 84.5 kB 30 kB 26.4 kB
runtime-dom.global.prod.js 105 kB (+93 B) 39.4 kB (+50 B) 35.5 kB (+19 B)
vue.global.prod.js 163 kB (+93 B) 59.6 kB (+48 B) 53.1 kB (+44 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 47.4 kB 18.5 kB 16.9 kB
createApp 56.2 kB 21.7 kB 19.8 kB
createApp + vaporInteropPlugin 79.9 kB (+837 B) 29.8 kB (+283 B) 27.1 kB (+302 B)
createVaporApp 31.3 kB (+431 B) 12 kB (+135 B) 11 kB (+129 B)
createSSRApp 60.5 kB 23.4 kB 21.4 kB
defineCustomElement 61.2 kB 23.2 kB 21.2 kB
overall 71.1 kB 27 kB 24.6 kB

@edison1105 edison1105 marked this pull request as draft July 21, 2025 13:07
@edison1105 edison1105 marked this pull request as ready for review July 22, 2025 02:27
@edison1105 edison1105 force-pushed the edison/feat/fowardedSlots branch from 6dfc12d to e92244e Compare July 22, 2025 05:51
@edison1105 edison1105 merged commit 2182e88 into minor Oct 20, 2025
17 checks passed
@edison1105 edison1105 deleted the edison/feat/fowardedSlots branch October 20, 2025 06:34
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.

2 participants