Skip to content

Commit

Permalink
Use compact utility function to normalize InMemoryCacheConfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Sep 23, 2021
1 parent 4ca9bf0 commit 124cd1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/cache/inmemory/inMemoryCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
StoreObject,
Reference,
isReference,
compact,
} from '../../utilities';
import {
ApolloReducerConfig,
Expand Down Expand Up @@ -87,7 +88,7 @@ export class InMemoryCache extends ApolloCache<NormalizedCacheObject> {

constructor(config: InMemoryCacheConfig = {}) {
super();
this.config = { ...defaultConfig, ...config };
this.config = compact(defaultConfig, config);
this.addTypename = !!this.config.addTypename;

this.policies = new Policies({
Expand Down
6 changes: 3 additions & 3 deletions src/cache/inmemory/readFromStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
maybeDeepFreeze,
isNonNullObject,
canUseWeakMap,
compact,
} from '../../utilities';
import { Cache } from '../core/types/Cache';
import {
Expand Down Expand Up @@ -142,11 +143,10 @@ export class StoreReader {
}

constructor(config: StoreReaderConfig) {
this.config = {
...config,
this.config = compact(config, {
addTypename: config.addTypename !== false,
canonizeResults: shouldCanonizeResults(config),
};
});

this.canon = config.canon || new ObjectCanon;

Expand Down

0 comments on commit 124cd1c

Please sign in to comment.