Skip to content

Commit 202103a

Browse files
miel-dev0Akryum
authored andcommitted
fix: fetching incorrect result from cache after an Apollo error (#343)
1 parent 5d9493b commit 202103a

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/smart-query.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,13 @@ export default class SmartQuery extends SmartApollo {
7070
}
7171

7272
executeApollo (variables) {
73-
if (this.observer) {
74-
// Update variables
75-
// Don't use setVariables directly or it will ignore cache
76-
this.observer.setOptions(this.generateApolloOptions(variables))
77-
} else {
78-
if (this.sub) {
79-
this.sub.unsubscribe()
80-
}
81-
82-
// Create observer
83-
this.observer = this.vm.$apollo.watchQuery(this.generateApolloOptions(variables))
73+
if (this.sub) {
74+
this.sub.unsubscribe()
8475
}
8576

77+
// Create observer
78+
this.observer = this.vm.$apollo.watchQuery(this.generateApolloOptions(variables))
79+
8680
this.startQuerySubscription()
8781

8882
if (this.options.fetchPolicy !== 'no-cache') {

0 commit comments

Comments
 (0)