Skip to content

Commit

Permalink
add workaround for the fact that removing the context means actual fe…
Browse files Browse the repository at this point in the history
…tches may trigger double updates and warning to fix
  • Loading branch information
designatednerd committed Sep 3, 2020
1 parent e049374 commit b775a9f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Tests/ApolloCacheDependentTests/WatchQueryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ class WatchQueryTests: XCTestCase, CacheTesting {
let hasPicardFriendExpecation = self.expectation(description: "Has friend named Jean-Luc Picard")
let hasHanSoloFriendExpecation = self.expectation(description: "Has friend named Han Solo")
let initialFetchExpectation = self.expectation(description: "Initial fetch")
var isInitialFetch = true
var expectedDependentKeys = [
"0.__typename",
"0.friends",
Expand All @@ -616,12 +615,14 @@ class WatchQueryTests: XCTestCase, CacheTesting {
"QUERY_ROOT.hero",
]

#warning("Figure out if there's a way not have the fetch also cause a cache update to fire without putting the context back in everywhere")
var fetchCount = 0
_ = client.watch(query: query) { result in
defer {
if isInitialFetch {
isInitialFetch = false
if fetchCount == 1 {
initialFetchExpectation.fulfill()
}
fetchCount += 1
}
switch result {
case .success(let graphQLResult):
Expand Down

0 comments on commit b775a9f

Please sign in to comment.