File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1122,6 +1122,24 @@ export class QueryManager {
1122
1122
return makeObservable ( variables ) ;
1123
1123
}
1124
1124
1125
+ public removeQuery ( queryId : string ) {
1126
+ // teardown all links
1127
+ // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises
1128
+ // that each add their reject functions to fetchCancelFns.
1129
+ // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.
1130
+ // The same queryId could have two rejection fns for two promises
1131
+ this . fetchCancelFns . delete ( queryId ) ;
1132
+ if ( this . queries . has ( queryId ) ) {
1133
+ const oq = this . queries . get ( queryId ) ! . observableQuery ;
1134
+ if ( oq ) {
1135
+ oq [ "resetNotifications" ] ( ) ;
1136
+ oq [ "unsubscribeFromCache" ] ?.( ) ;
1137
+ oq . stopPolling ( ) ;
1138
+ }
1139
+ this . queries . delete ( queryId ) ;
1140
+ }
1141
+ }
1142
+
1125
1143
public broadcastQueries ( ) {
1126
1144
if ( this . onBroadcast ) this . onBroadcast ( ) ;
1127
1145
this . obsQueries . forEach ( ( observableQuery ) => observableQuery . notify ( ) ) ;
You can’t perform that action at this time.
0 commit comments