Skip to content

Commit 19c0c74

Browse files
committed
Update some comments
1 parent ffbf775 commit 19c0c74

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/core/QueryInfo.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ export class QueryInfo<
143143
this.queryManager = queryManager;
144144

145145
// Track how often cache.evict is called, since we want eviction to
146-
// override the feud-stopping logic in the markQueryResult method, by
147-
// causing shouldWrite to return true. Wrapping the cache.evict method
148-
// is a bit of a hack, but it saves us from having to make eviction
149-
// counting an official part of the ApolloCache API.
146+
// override the write-skipping logic in `shouldWrite`, by causing it to
147+
// return true. Wrapping the cache.evict method is a bit of a hack, but it
148+
// saves us from having to make eviction counting an official part of the
149+
// ApolloCache API.
150150
if (!destructiveMethodCounts.has(cache)) {
151151
destructiveMethodCounts.set(cache, 0);
152152
wrapDestructiveCacheMethod(cache, "evict");
@@ -157,8 +157,14 @@ export class QueryInfo<
157157

158158
/**
159159
* @internal
160-
* For feud-preventing behaviour, `lastWrite` should be shared by all `QueryInfo` instances of an `ObservableQuery`.
161-
* In the case of a standalone `QueryInfo`, we will keep a local version.
160+
* Tracks the last result written to the cache so that `shouldWrite` can skip
161+
* an identical write. Since a `QueryInfo` only ever represents a single
162+
* network request, this is shared by all `QueryInfo` instances of an
163+
* `ObservableQuery`. A standalone `QueryInfo` keeps a local version.
164+
*
165+
* A network result that was explicitly asked for always takes precedence over
166+
* what is already cached, so `ObservableQuery.refetch` and polling clear this
167+
* value before starting their request.
162168
*/
163169
public _lastWrite?: LastWrite;
164170
private get lastWrite(): LastWrite | undefined {

0 commit comments

Comments
 (0)