Skip to content

Commit 8493681

Browse files
committed
Add private get for cache in ObservableQuery
1 parent 23a21d8 commit 8493681

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/core/ObservableQuery.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ export class ObservableQuery<
356356
return this.subject.getValue().result.networkStatus;
357357
}
358358

359+
private get cache() {
360+
return this.queryManager.cache;
361+
}
362+
359363
constructor({
360364
queryManager,
361365
options,
@@ -559,7 +563,7 @@ export class ObservableQuery<
559563
* @internal
560564
*/
561565
public getCacheDiff({ optimistic = true } = {}) {
562-
return this.queryManager.cache.diff<TData>({
566+
return this.cache.diff<TData>({
563567
query: this.query,
564568
variables: this.variables,
565569
returnPartialData: true,
@@ -694,7 +698,7 @@ export class ObservableQuery<
694698
}
695699
},
696700
};
697-
const cancelWatch = this.queryManager.cache.watch(watch);
701+
const cancelWatch = this.cache.watch(watch);
698702

699703
this.unsubscribeFromCache = Object.assign(
700704
() => {
@@ -937,7 +941,7 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`,
937941
// updates. Most watchers will be using the QueryInfo class, which
938942
// responds to notifications by calling reobserveCacheFirst to deliver
939943
// fetchMore cache results back to this ObservableQuery.
940-
this.queryManager.cache.batch({
944+
this.cache.batch({
941945
update: (cache) => {
942946
if (updateQuery) {
943947
cache.updateQuery(
@@ -1202,7 +1206,7 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`,
12021206
);
12031207

12041208
if (newResult) {
1205-
queryManager.cache.writeQuery({
1209+
this.cache.writeQuery({
12061210
query: this.options.query,
12071211
data: newResult,
12081212
variables: this.variables,

0 commit comments

Comments
 (0)