Skip to content

Commit

Permalink
Fix partial cache write
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodyowl committed Apr 3, 2024
1 parent 4e355d2 commit 31621fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/cache/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class ClientCache {
return match(getCacheKeyFromJson(value))
.with(Option.P.Some(P.select()), (cacheKey) => {
const existingEntry = this.getOrDefault(cacheKey);
this.cache.set(
this.set(
cacheKey,
mergeCacheEntries(existingEntry, {
requestedKeys,
Expand Down
20 changes: 11 additions & 9 deletions src/cache/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ export const writeOperationToCache = (
}
}
} else {
cache.updateFieldInClosestCachedAncestor({
originalFieldName,
fieldNameWithArguments,
value: fieldValue,
path,
ancestors: data,
variables: fieldArguments,
rootTypename,
});
if (originalFieldName in parent) {
cache.updateFieldInClosestCachedAncestor({
originalFieldName,
fieldNameWithArguments,
value: fieldValue,
path,
ancestors: data,
variables: fieldArguments,
rootTypename,
});
}
}
})
.with({ kind: Kind.INLINE_FRAGMENT }, (inlineFragmentNode) => {
Expand Down

0 comments on commit 31621fd

Please sign in to comment.