-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(nuxt): Expose vueIntegration
#14526
Conversation
size-limit report 📦
|
vueIntegration({ | ||
// We pick up the options from the "fake" vueIntegration exported by the SDK. | ||
...(GLOBAL_OBJ as GlobalObjWithIntegrationOptions)._sentryNuxtVueIntegrationOptions, | ||
app: vueApp, | ||
attachErrorHandler: false, | ||
}), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question: If users add a vueIntegration
as well, can this even be another another time? I remember it's not possible to add the same integration twice.
What we could do is removing this addIntegration
part here and add the vueIntegration
as default integration in the default integration array (users can overwrite those integrations). As we need to get the vueApp
in the integration, we can get it from window.useNuxtApp().vueApp
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why I immediately went with this solution is because I thought the vueApp
is initialized rather late - at least later than Sentry.init()
is called. In that case, we would initialize the SDK (and call the integrations' setup method) before window.useNuxtApp()
is even available. Is my concern valid? I think you know more than me in this regard.
If users add a vueIntegration as well
I don't think I fully understand this question. Can you clarify a bit?
How this PR is currently implemented, the configuration added by the user would "win" and their options are used when we add the vueIntegration()
in the nuxt plugin setup
hook.
The entire point of this PR is that users can add their own vueIntegration()
. Maybe I am also misunderstanding. In case you are worried about "us adding the integration twice", that is actually not the case in this PR - the name between the @sentry/nuxt
vueIntegration()
and the @sentry/vue
integration differs slightly, so they will both be set up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is my concern valid?
In the client-case, the Nuxt app is initialized before Sentry. I haven't tried so far but it should work in theory.
integration differs slightly
True, I wasn't thinking about that...those are two different integrations and not the same. And the new Nuxt vueIntegration
is only setting the options, the logic is inside Vue vueIntegration
which will still be added but with the added options? I understood it now :D
All good - I should have read the comment in the integration
Done as part of #14265
We are exposing the vueIntegration so we can streamline how component tracking is configured.