Subwaytime / waku

Vue 3 Component DOM Mounting
https://vue-mountable.netlify.app
MIT License
12 stars 2 forks source link

Add support for multiple apps #2

Closed skirtles-code closed 3 years ago

skirtles-code commented 3 years ago

service.ts shares container, node and instance between usages. This causes problems if the plugin is installed on multiple apps. e.g.:

import { createApp } from 'vue'
import { VueMountable } from 'vue-mountable'
import App from './App.vue'

const app = createApp(App)
app.use(VueMountable)
app.provide('msg', 'app1')
app.mount('#app')

const app2 = createApp(App)
app2.use(VueMountable)
app2.provide('msg', 'app2')
app2.mount('#app2')

The functions provided by useComponent will then be bound to the second app in both cases. So, for example, attempting to inject the msg from inside a component mounted by VueMountable will always show app2, irrespective of which app it is in.

Subwaytime commented 3 years ago

Thanks for reporting this! Havent looked into multiple instance support by now, but should be fairly easy to resolve!

Subwaytime commented 3 years ago

fixed with version v0.0.5