Skip to content

Commit 8dbcadd

Browse files
FriziGuillaume Chau
authored andcommitted
Prevent overeager subscription restarts on variable reevaluation without change (#116)
1 parent 3e1b46e commit 8dbcadd

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

dist/vue-apollo.esm.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,9 +2961,15 @@ var SmartSubscription = function (_SmartApollo2) {
29612961
createClass(SmartSubscription, [{
29622962
key: 'executeApollo',
29632963
value: function executeApollo(variables) {
2964+
var variablesJson = JSON.stringify(variables);
29642965
if (this.sub) {
2966+
// do nothing if subscription is already running using exactly the same variables
2967+
if (variablesJson === this.previousVariablesJson) {
2968+
return;
2969+
}
29652970
this.sub.unsubscribe();
29662971
}
2972+
this.previousVariablesJson = variablesJson;
29672973

29682974
var apolloOptions = this.generateApolloOptions(variables);
29692975

0 commit comments

Comments
 (0)