Skip to content

Commit

Permalink
Allow different types of fetches on a watcher
Browse files Browse the repository at this point in the history
Publicly exposing the fetch() function would allow us to make other kinds of fetches besides the `fetchIgnoringCacheData` exposed by `refetch()`. Our use case is that our custom version of `InMemoryNormalizedCache` has cache expiration, and we want to be able to hit the network only if the cache has become invalid. Alternately, we could manually check the cache, but this seems cleaner.
  • Loading branch information
gsbernstein authored May 20, 2021
1 parent 9630b6e commit c95c5af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Apollo/GraphQLQueryWatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public final class GraphQLQueryWatcher<Query: GraphQLQuery>: Cancellable, Apollo
fetch(cachePolicy: .fetchIgnoringCacheData)
}

func fetch(cachePolicy: CachePolicy) {
public func fetch(cachePolicy: CachePolicy) {
fetching.mutate {
// Cancel anything already in flight before starting a new fetch
$0?.cancel()
Expand Down

0 comments on commit c95c5af

Please sign in to comment.