Skip to content

Commit b775a9f

Browse files
add workaround for the fact that removing the context means actual fetches may trigger double updates and warning to fix
1 parent e049374 commit b775a9f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Tests/ApolloCacheDependentTests/WatchQueryTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,6 @@ class WatchQueryTests: XCTestCase, CacheTesting {
604604
let hasPicardFriendExpecation = self.expectation(description: "Has friend named Jean-Luc Picard")
605605
let hasHanSoloFriendExpecation = self.expectation(description: "Has friend named Han Solo")
606606
let initialFetchExpectation = self.expectation(description: "Initial fetch")
607-
var isInitialFetch = true
608607
var expectedDependentKeys = [
609608
"0.__typename",
610609
"0.friends",
@@ -616,12 +615,14 @@ class WatchQueryTests: XCTestCase, CacheTesting {
616615
"QUERY_ROOT.hero",
617616
]
618617

618+
#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")
619+
var fetchCount = 0
619620
_ = client.watch(query: query) { result in
620621
defer {
621-
if isInitialFetch {
622-
isInitialFetch = false
622+
if fetchCount == 1 {
623623
initialFetchExpectation.fulfill()
624624
}
625+
fetchCount += 1
625626
}
626627
switch result {
627628
case .success(let graphQLResult):

0 commit comments

Comments
 (0)