Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core): return the exposeProxy from mount #4606

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

skirtles-code
Copy link
Contributor

When using expose or defineExpose, the 'public' instance (exposeProxy) is used for template refs, $parent and $root. The instance returned by mount is currently still the internal instance.

const vm = createApp({
  setup(_, { expose }) {
    expose({ a: 1 })
    return () => h('div')
  }
}).mount('#app')

console.log(vm.a) // undefined as vm is the internal instance

This PR changes mount to return the exposeProxy.

I couldn't find any mention of mount in either the RFC or the associated discussion thread:

I'm assuming it was simply overlooked, but if there is a good reason why mount should return the internal instance then it should probably be added to that thread.

I'm not sure whether this might impact tooling or testing, which might be relying on using mount to get to the internals of a <script setup> component. While I wouldn't necessarily call this a 'breaking change', I think it might be considered breaking enough to need to wait for 3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants