Skip to content

Commit

Permalink
Make StoreReader canon field public.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Jun 28, 2021
1 parent bb09653 commit 1360139
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cache/inmemory/__tests__/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ describe('Cache', () => {
const originalMBW = cache["maybeBroadcastWatch"];
expect(typeof originalMBW).toBe("function");

const originalCanon = originalReader["canon"];
const originalCanon = originalReader.canon;
expect(originalCanon).toBeInstanceOf(ObjectCanon);

cache.writeQuery({
Expand Down Expand Up @@ -1379,7 +1379,7 @@ describe('Cache', () => {
expect(originalMBW).not.toBe(cache["maybeBroadcastWatch"]);
// The cache.storeReader.canon is preserved by default, but can be dropped
// by passing preserveCanon:false to cache.gc.
expect(originalCanon).toBe(cache["storeReader"]["canon"]);
expect(originalCanon).toBe(cache["storeReader"].canon);
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/cache/inmemory/__tests__/readFromStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ describe('reading from the store', () => {
},
});

const canon = cache["storeReader"]["canon"];
const canon = cache["storeReader"].canon;

const query = gql`
query {
Expand Down Expand Up @@ -2081,7 +2081,7 @@ describe('reading from the store', () => {
},
});

const canon = cache["storeReader"]["canon"];
const canon = cache["storeReader"].canon;

const fragment = gql`
fragment CountFragment on Query {
Expand Down
2 changes: 1 addition & 1 deletion src/cache/inmemory/inMemoryCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class InMemoryCache extends ApolloCache<NormalizedCacheObject> {
canon: (
preserveCanon &&
previousReader &&
previousReader["canon"]
previousReader.canon
) || void 0,
}),
);
Expand Down
4 changes: 2 additions & 2 deletions src/cache/inmemory/readFromStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ export class StoreReader {
resultCacheMaxSize?: number;
};

private canon: ObjectCanon;

private knownResults = new (
canUseWeakMap ? WeakMap : Map
)<Record<string, any>, SelectionSetNode>();

public canon: ObjectCanon;

constructor(config: StoreReaderConfig) {
this.config = {
...config,
Expand Down

0 comments on commit 1360139

Please sign in to comment.