Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The metadata is still unavailable in production build. #3715

Closed
3 tasks done
alpavlove opened this issue Dec 6, 2024 · 0 comments · Fixed by #3714
Closed
3 tasks done

The metadata is still unavailable in production build. #3715

alpavlove opened this issue Dec 6, 2024 · 0 comments · Fixed by #3714

Comments

@alpavlove
Copy link
Contributor

alpavlove commented Dec 6, 2024

Describe the bug

I am using the urql client with the cache exchange on a server and need to access the cacheOutcome to track cache hit/miss metrics. Here’s an example of how I'm trying to use it:

const result = await client.query(query, variables, context).toPromise();
const outcome = result.operation.context.meta?.cacheOutcome;

if (outcome) {
  metrics.cacheOutcomeCounter.inc({ outcome });
}

As mentioned in this discussion and this issue the meta object (including cacheOutcome) is still unavailable in production, despite previous efforts to bring it back. As a result, cacheOutcome always defaults to a miss.

I've submitted a PR to fix this: #3715. Let me know if any changes are needed!

Reproduction

N/A

Urql version

5.0.4

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant