-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Unable to use useNuxtApp()
since @tresjs/[email protected]
#33
Comments
Hey @kekkorider try the new release, I updated the core here #35 |
@alvarosabu if you're talking about the |
I meant updating the version of the |
Just updated |
Hey @danielroe I might need your support here. 😅
To fix the devtools, we introduce these changes on This means we don't longer mount a second app with the Tres renderer, We actually managed to have a "reconciliation" layer inside Any idea if we could potentially fix this? Appreciate your time 🙏🏻 |
If this is purely client-side, you can access the current Nuxt app instance with |
Just made a quick test 👇
This way, it works. I also tested some other potential solutions, but none of these succeeded 👇
|
I'm not entirely sure of the details - maybe a reproduction would help me. Ideally users wouldn't need to update their code, and should be able to use Are all the Nuxt injections missing from the Tres canvas? |
@danielroe thanks for the reply! Have you checked the reproduction link? 👉 https://stackblitz.com/github/kekkorider/nuxt-tres-starter/tree/tresjs-core-3-1?file=components%2FSampleBox.vue By default the application breaks, but if you follow my instructions you'll see that it works
|
I tested a bunch of random composables provided by Nuxt, most of them don't work and trigger the same error.
|
I think there will be a lot of situations where users expect to be able to access an injection provided by a module's plugin, for example. Might be worth considering how to proxy injections across? Depending on the lifecycle (is the tres app created subsequent to all nuxt plugins?) you might be able to pass the injections across. |
Yeah users should be able to acces those In the
Being @danielroe to inject them would be at this level or in the nuxt module itself? |
I have the same error here, any fix? |
@danielroe been investigating a little bit and the problem is that when Since all this composable on nuxt uses it, they get broken. Actually, @enpitsuLin helped us out with the custom render, there would be any way to provide the custom renderer the |
It seems that using the custom renderer will create appContext which doesn't contain context from the root Vue App(Like Nuxt provided), I think this is expected use custom renderer will create separate contexts just like creating different App Instances, whether using the we need to provide useful context alone as TresJs does but it's unreasonable, I think proxy the root App's context to the context created by the custom renderer might be a solution, but don't know how to :) |
Hi @enpitsuLin thanks for your insights! I manually proxy the context of the vue wrapper app to the TresJS one, really manual, not sure if it's the best approach but, might fix the issue. Do you mind to give it a look? Thanks for your support |
Confirming that with the |
Describe the bug
I tried upgrading the
@tresjs/core
package from3.0.1
to3.1.x
and now every attempt to use theuseNuxtApp()
composable breaks the application.Reproduction
https://stackblitz.com/github/kekkorider/nuxt-tres-starter/tree/tresjs-core-3-1?file=components%2FSampleBox.vue
Steps to reproduce
In
/components/SampleBox.vue
, comment out line 19, the one whereuseNuxtApp()
is used.The error will be gone.
System Info
Used Package Manager
pnpm
Code of Conduct
The text was updated successfully, but these errors were encountered: