Skip to content

Commit

Permalink
fix(core): add back cacheOutcome (#3464)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Jan 17, 2024
1 parent ef2b57d commit 93d7256
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 93d7256

Please sign in to comment.