Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(core): make `metadata` available in production (#3714)

Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>

authored by

Alexey Pavlov
Jovi De Croock
and committed by
GitHub
4d1b14ec cf43315c

+5 -16
+5
.changeset/fluffy-starfishes-unite.md
··· 1 + --- 2 + '@urql/core': minor 3 + --- 4 + 5 + Remove `addMetadata` transform where we'd strip out metadata for production environments, this particularly affects `OperationResult.context.metadata.cacheOutcome`
-16
scripts/babel/transform-debug-target.mjs
··· 4 4 process.env.NODE_ENV !== 'production' ? NODE : undefined 5 5 `.trim(); 6 6 7 - const noopTransformTemplate = ` 8 - process.env.NODE_ENV !== 'production' ? NODE : FALLBACK 9 - `.trim(); 10 - 11 7 const plugin = ({ template, types: t }) => { 12 8 const wrapWithDevCheck = template.expression(warningDevCheckTemplate, { 13 9 placeholderPattern: /^NODE$/, 14 - }); 15 - 16 - const wrapWithNoopTransform = template.expression(noopTransformTemplate, { 17 - placeholderPattern: /^(NODE|FALLBACK)$/, 18 10 }); 19 11 20 12 let name = 'unknownExchange'; ··· 47 39 } 48 40 49 41 path.replaceWith(wrapWithDevCheck({ NODE: path.node })); 50 - } else if (path.node.callee.name === 'addMetadata') { 51 - path.node[visited] = true; 52 - path.replaceWith( 53 - wrapWithNoopTransform({ 54 - NODE: path.node, 55 - FALLBACK: path.node.arguments[0], 56 - }) 57 - ); 58 42 } 59 43 }, 60 44 },