Skip to content

Commit

Permalink
Don't refetch getOne() queries when reseting store (when logging out)…
Browse files Browse the repository at this point in the history
… #7732

Since Apollo 3 the cache-and-network behavior changed as explained in details
in the following comment. So we need to specify that our query must not be refetched
from network when the cache changes. In our specific the cache changes, is the reseting.

See apollographql/apollo-client#6760
  • Loading branch information
PowerKiKi committed Dec 21, 2020
1 parent 34adf37 commit 0f2e6ab
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export abstract class NaturalAbstractModelService<
query: this.oneQuery,
variables: this.getVariablesForOne(id),
fetchPolicy: 'cache-and-network',
nextFetchPolicy: 'cache-only',
});

const subscription = queryRef.valueChanges.pipe(filter(r => !!r.data)).subscribe(result => {
Expand Down

0 comments on commit 0f2e6ab

Please sign in to comment.