Skip to content

Commit

Permalink
fix: subscriptions array leak (#1248)
Browse files Browse the repository at this point in the history
  • Loading branch information
lueurxax committed May 3, 2022
1 parent af9f20f commit f31fa15
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/vue-apollo-option/src/dollar-apollo.js
Expand Up @@ -148,7 +148,13 @@ export class DollarApollo {
smart.autostart()

if (options.linkedQuery) {
options.linkedQuery._linkedSubscriptions.push(smart)
// prevent subscriptions leak on fetching query with another parameters
const index = options.linkedQuery._linkedSubscriptions.findIndex(x => x.key === key)
if (index !== -1) {
options.linkedQuery._linkedSubscriptions[index] = smart
} else {
options.linkedQuery._linkedSubscriptions.push(smart)
}
}

return smart
Expand Down

0 comments on commit f31fa15

Please sign in to comment.