Skip to content

Commit f31fa15

Browse files
authored
fix: subscriptions array leak (#1248)
1 parent af9f20f commit f31fa15

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/vue-apollo-option/src/dollar-apollo.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ export class DollarApollo {
148148
smart.autostart()
149149

150150
if (options.linkedQuery) {
151-
options.linkedQuery._linkedSubscriptions.push(smart)
151+
// prevent subscriptions leak on fetching query with another parameters
152+
const index = options.linkedQuery._linkedSubscriptions.findIndex(x => x.key === key)
153+
if (index !== -1) {
154+
options.linkedQuery._linkedSubscriptions[index] = smart
155+
} else {
156+
options.linkedQuery._linkedSubscriptions.push(smart)
157+
}
152158
}
153159

154160
return smart

0 commit comments

Comments
 (0)