Skip to content

Commit

Permalink
fix: memory leak in SSR caused by global tracking (#1582)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabis94 authored Jan 9, 2025
1 parent 8a5f424 commit b57f2be
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/vue-apollo-composable/src/util/loadingTracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ export function getCurrentTracking () {
}

let tracking: LoadingTracking
if (isServer) {
// SSR does not support onScopeDispose, so if we don't skip this, it will leak memory
tracking = {
queries: ref(0),
mutations: ref(0),
subscriptions: ref(0),
}
return { tracking }
}

if (!globalTracking.components.has(currentScope)) {
// Add per-component tracking
Expand Down

0 comments on commit b57f2be

Please sign in to comment.