Skip to content

feat(runtime-core): export currentInstance methods#5472

Open
sibbng wants to merge 5 commits into
vuejs:mainfrom
sibbng:feat/export-currentinstance
Open

feat(runtime-core): export currentInstance methods#5472
sibbng wants to merge 5 commits into
vuejs:mainfrom
sibbng:feat/export-currentinstance

Conversation

@sibbng

@sibbng sibbng commented Feb 22, 2022

Copy link
Copy Markdown

Close #4611

Hi, I'm maintainer of reactivue. I rewrote it from scratch and managed to shrink it down to ~150 lines by using EffectScope API. But to support Vue plugins like pinia, @vueuse/head I needed to access setCurrentInstance method.

@netlify

netlify Bot commented Feb 22, 2022

Copy link
Copy Markdown

❌ Deploy Preview for vuejs-coverage failed.

🔨 Explore the source changes: 414cf91

🔍 Inspect the deploy log: https://app.netlify.com/sites/vuejs-coverage/deploys/62220dcdfe83880007903cd6

@netlify

netlify Bot commented Feb 22, 2022

Copy link
Copy Markdown

✔️ Deploy Preview for vue-next-template-explorer ready!

🔨 Explore the source changes: 414cf91

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-next-template-explorer/deploys/62220dcd35403800073a86e4

😎 Browse the preview: https://deploy-preview-5472--vue-next-template-explorer.netlify.app

@netlify

netlify Bot commented Feb 22, 2022

Copy link
Copy Markdown

Deploy Preview for vue-sfc-playground failed.

Name Link
🔨 Latest commit 0663df1
🔍 Latest deploy log https://app.netlify.com/sites/vue-sfc-playground/deploys/6718ac5c20300f0008213948

@LinusBorg

Copy link
Copy Markdown
Member

I'm not sure we feel comfortable exposing hooks into these internals.

Can you share a bit more about the use case and what problem this solves?

@sibbng sibbng mentioned this pull request Mar 1, 2022
3 tasks
@crutchcorn

crutchcorn commented Mar 1, 2022

Copy link
Copy Markdown

@LinusBorg I actually wrote a lot about that here

#4611

That said, how about we export this under a namespace similar to how we export SSR utils?

@edison1105

Copy link
Copy Markdown
Member

a workaround see #4611 (comment)

@edison1105 edison1105 added the ready for review This PR requires more reviews label Oct 23, 2024
@github-actions

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB (+370 B) 38 kB (+51 B) 34.2 kB (+52 B)
vue.global.prod.js 159 kB (+370 B) 57.9 kB (+35 B) 51.5 kB (+84 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.9 kB 18.3 kB 16.7 kB
createApp 55 kB 21.3 kB 19.4 kB
createSSRApp 59 kB 23 kB 20.9 kB
defineCustomElement 59.8 kB 22.8 kB 20.8 kB
overall 68.7 kB 26.3 kB 24 kB

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2024

Copy link
Copy Markdown

Open in Stackblitz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@5472

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@5472

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@5472

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@5472

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@5472

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@5472

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@5472

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@5472

vue

pnpm add https://pkg.pr.new/vue@5472

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@5472

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@5472

commit: 62a9af5

@geferon

geferon commented Jan 5, 2025

Copy link
Copy Markdown

Would be nice to have these methods expose for other libraries to use...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review This PR requires more reviews version: minor

Projects

Status: Needs further expertise

Development

Successfully merging this pull request may close these issues.

Export "setComponent" in @vue/runtime-core

6 participants