fix: subscriptions array leak (#1248)

This commit is contained in:
ANDREY KHASANOV
2022-05-03 11:54:17 +03:00
committed by GitHub
parent af9f20f131
commit f31fa1520c
@@ -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