Skip to content

Commit b57f2be

Browse files
authored
fix: memory leak in SSR caused by global tracking (#1582)
1 parent 8a5f424 commit b57f2be

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: packages/vue-apollo-composable/src/util/loadingTracking.ts

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ export function getCurrentTracking () {
2727
}
2828

2929
let tracking: LoadingTracking
30+
if (isServer) {
31+
// SSR does not support onScopeDispose, so if we don't skip this, it will leak memory
32+
tracking = {
33+
queries: ref(0),
34+
mutations: ref(0),
35+
subscriptions: ref(0),
36+
}
37+
return { tracking }
38+
}
3039

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

0 commit comments

Comments
 (0)