Skip to content

Commit

Permalink
add back cacheOutcome
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Dec 13, 2023
1 parent 73628b7 commit b3c39c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-pigs-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@urql/core': patch
---

Add back our cache-outcome on the document-cache, this was behind a development flag however in our normalized cache we always add it already
14 changes: 6 additions & 8 deletions packages/core/src/exchanges/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,12 @@ export const cacheExchange: Exchange = ({ forward, client, dispatchDebug }) => {
data: null,
});

if (process.env.NODE_ENV !== 'production') {
result = {
...result,
operation: addMetadata(operation, {
cacheOutcome: cachedResult ? 'hit' : 'miss',
}),
};
}
result = {
...result,
operation: addMetadata(operation, {
cacheOutcome: cachedResult ? 'hit' : 'miss',
}),
};

if (operation.context.requestPolicy === 'cache-and-network') {
result.stale = true;
Expand Down

0 comments on commit b3c39c1

Please sign in to comment.