-
-
Notifications
You must be signed in to change notification settings - Fork 108
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: proxy app context #394
Conversation
✅ Deploy Preview for tresjs-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I'm a little busy these days because I sent in my resignation last week :) for that issue, I took some time to check how it happened, We can see here that does assign appContext in I think just extend appContext and provides should work, but didn't test in nuxt module and globalProperties, separated multi repo makes testing difficult diff --git a/src/components/TresCanvas.vue b/src/components/TresCanvas.vue
index 45b2fe8..d29cadf 100644
--- a/src/components/TresCanvas.vue
+++ b/src/components/TresCanvas.vue
@@ -18,7 +18,7 @@ import {
Fragment,
defineComponent,
h,
-} from 'vue'
+ getCurrentInstance } from 'vue'
import {
useTresContextProvider,
useLogger,
@@ -80,12 +80,25 @@ const { resume } = useRenderLoop()
const slots = defineSlots<{
default(): any
}>()
+const instance = getCurrentInstance()!
const createInternalComponent = (context: TresContext) =>
defineComponent({
setup() {
provide('useTres', context)
provide('extend', extend)
+
+ const inner = getCurrentInstance()!
+ Object.assign(inner.appContext, instance.appContext)
+ //@ts-expect-error: internal property
+ Object.assign(inner.provides, inner.appContext.provides)
+ if (import.meta.env.DEV) {
+ //@ts-expect-error: internal property
+ inner.appContext.reload = () => {
+ mountCustomRenderer(context)
+ }
+ }
+
return () => h(Fragment, null, slots?.default ? slots.default() : [])
},
})
@@ -157,7 +170,7 @@ onMounted(() => {
if (!camera.value) {
logWarning(
'No camera found. Creating a default perspective camera. '
- + 'To have full control over a camera, please add one to the scene.',
+ + 'To have full control over a camera, please add one to the scene.',
)
addDefaultCamera()
} |
Hi @enpitsuLin I really appreciate you taking the time, No worries. Get your stuff sorted out first. I will create a fake release on the next channel so we can test it in other repositories. 🤗 |
This reverts commit a144712.
This might solve Tresjs/nuxt#33