Skip to content

Commit

Permalink
fixed object unsubscribed error
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Oct 14, 2021
1 parent 7426a5d commit 07ec719
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Expand Up @@ -70,7 +70,9 @@ class PluginEventGroup {
return {
unsubscribe: () => {
this.subscriptions = this.subscriptions.filter(_ => _ !== subscription);
return subscription.unsubscribe();
if (!subscription.closed) {
return subscription.unsubscribe();
}
},
};
}
Expand Down
Expand Up @@ -56,6 +56,7 @@ export class SubscriptionProviderRegistryService {
}

getAllProviderData$() {
return this.list$;
// return a new observable each time to separate the subscriptions
return this.list$.asObservable();
}
}
6 changes: 4 additions & 2 deletions packages/altair-core/src/subscriptions/providers/app-sync.ts
Expand Up @@ -6,7 +6,7 @@ import { ApolloClient, ApolloLink, InMemoryCache } from '@apollo/client/core';
import { parse } from 'graphql';

export class AppSyncSubscriptionProvider extends SubscriptionProvider {
subscription?: any;
subscription?: ZenObservable.Subscription;

/**
{
Expand Down Expand Up @@ -52,6 +52,8 @@ export class AppSyncSubscriptionProvider extends SubscriptionProvider {
}

close() {
this.subscription?.unsubscribe();
if (this.subscription?.closed) {
this.subscription?.unsubscribe();
}
}
}

0 comments on commit 07ec719

Please sign in to comment.