diff --git a/.changeset/fluffy-starfishes-unite.md b/.changeset/fluffy-starfishes-unite.md new file mode 100644 index 0000000000..44bdf95df2 --- /dev/null +++ b/.changeset/fluffy-starfishes-unite.md @@ -0,0 +1,5 @@ +--- +'@urql/core': minor +--- + +Remove `addMetadata` transform where we'd strip out metadata for production environments, this particularly affects `OperationResult.context.metadata.cacheOutcome` diff --git a/scripts/babel/transform-debug-target.mjs b/scripts/babel/transform-debug-target.mjs index f7d5039f8b..0a0e0e3aa4 100644 --- a/scripts/babel/transform-debug-target.mjs +++ b/scripts/babel/transform-debug-target.mjs @@ -4,19 +4,11 @@ const warningDevCheckTemplate = ` process.env.NODE_ENV !== 'production' ? NODE : undefined `.trim(); -const noopTransformTemplate = ` - process.env.NODE_ENV !== 'production' ? NODE : FALLBACK -`.trim(); - const plugin = ({ template, types: t }) => { const wrapWithDevCheck = template.expression(warningDevCheckTemplate, { placeholderPattern: /^NODE$/, }); - const wrapWithNoopTransform = template.expression(noopTransformTemplate, { - placeholderPattern: /^(NODE|FALLBACK)$/, - }); - let name = 'unknownExchange'; return { @@ -47,14 +39,6 @@ const plugin = ({ template, types: t }) => { } path.replaceWith(wrapWithDevCheck({ NODE: path.node })); - } else if (path.node.callee.name === 'addMetadata') { - path.node[visited] = true; - path.replaceWith( - wrapWithNoopTransform({ - NODE: path.node, - FALLBACK: path.node.arguments[0], - }) - ); } }, },