fix(deps): update dependency @sentry/browser to v8

This commit is contained in:
Renovate
2024-05-21 13:58:45 +00:00
parent 9773d71ca0
commit 08debebb3b
3 changed files with 60 additions and 126 deletions
+2 -38
View File
@@ -1,6 +1,5 @@
import {
ApolloClient,
ApolloLink,
createHttpLink,
from,
InMemoryCache,
@@ -67,40 +66,7 @@ const authLink = setContext(async (_, { headers }) => {
}))
})
const traceHeaders = setContext((_, { headers }) => {
const th = Sentry.getCurrentHub().traceHeaders()
return {
headers: {
...headers,
...th,
},
}
})
const sentryTransactionLink = new ApolloLink((operation, forward) => {
const existingTransaction = Sentry.getCurrentHub()
.getScope()
?.getTransaction()
// Create a transaction if one does not exist in order to work around
// https://github.com/getsentry/sentry-javascript/issues/3169
// https://github.com/getsentry/sentry-javascript/issues/4072
const transaction =
existingTransaction ??
Sentry.startTransaction({
name: `Apollo Request: ${operation.operationName}`,
})
Sentry.getCurrentHub().configureScope((scope) => scope.setSpan(transaction))
operation.setContext({ tracing: { transaction } })
return forward(operation).map((data) => {
operation.getContext().tracing?.transaction?.finish()
return data
})
})
const link = sentryTransactionLink.concat(
traceHeaders.concat(
const link =
from([
new SentryLink({}),
split(
@@ -114,9 +80,7 @@ const link = sentryTransactionLink.concat(
authLink.concat(wsLink),
authLink.concat(httpLink),
),
]),
),
)
])
const instance = new ApolloClient({
connectToDevTools: true,