Skip to content

Commit 034830c

Browse files
Fix logic of integration building to work for defaults
1 parent ec192fe commit 034830c

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

src/runtime/sentry.client.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,32 +125,31 @@ export default defineNuxtPlugin({
125125
function buildIntegrations(integrationConfig: ClientIntegrationConfig, nuxtApp: _NuxtApp) {
126126
const integrations: Integration[] = []
127127

128-
for (const [name, options] of Object.entries(
129-
integrationConfig,
130-
) as Entries<ClientIntegrationConfig>) {
128+
for (const [name, integration] of Object.entries(integrationMap) as Entries<
129+
typeof integrationMap
130+
>) {
131+
const options = integrationConfig[name]
132+
131133
// If the integration is disabled, skip it
132134
if (options === false) continue
133135

134136
// If the integration hasn't been configured and isn't a default, skip it
135137
if (options == null && !defaultIntegrations.includes(name)) continue
136138

137-
const integration = integrationMap[name as ClientIntegrations]
138-
if (integration) {
139-
const integrationOptions = options === true ? undefined : options
140-
141-
if (name === "BrowserTracing") {
142-
const browserOptions = integrationOptions as BrowserTracingOptions | undefined
143-
integrations.push(
144-
vueBrowserTracingIntegration({
145-
...browserOptions,
146-
router: nuxtApp.vueApp.$nuxt.$router,
147-
}),
148-
)
149-
continue
150-
}
151-
152-
integrations.push(integration(options === true ? undefined : options))
139+
const integrationOptions = options === true ? undefined : options
140+
141+
if (name === "BrowserTracing") {
142+
const browserOptions = integrationOptions as BrowserTracingOptions | undefined
143+
integrations.push(
144+
vueBrowserTracingIntegration({
145+
...browserOptions,
146+
router: nuxtApp.vueApp.$nuxt.$router,
147+
}),
148+
)
149+
continue
153150
}
151+
152+
integrations.push(integration(options === true ? undefined : options))
154153
}
155154

156155
return integrations

0 commit comments

Comments
 (0)