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

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

Merged

Conversation

alpavlove
Copy link
Contributor

@alpavlove alpavlove commented Dec 5, 2024

Fixes #3715

Summary

This change addresses a bug where the addMetadata function was being stripped or modified in production builds, resulting in the meta field being unavailable. The absence of meta caused inconsistent behaviour between development and production environments, particularly for TTL-based re-requests and cache outcomes.

Previously, there was an attempt to add back the meta to production bundles, but perhaps the babel file was missed.

Set of Changes

Modified Babel Transformer:

Updated the Babel transformer to preserve addMetadata calls in production, ensuring metadata (e.g., cacheOutcome) is always available.

Affected Package:

@urql/core: The core package was updated to fix the issue.

Copy link

changeset-bot bot commented Dec 5, 2024

🦋 Changeset detected

Latest commit: d1aa67a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@urql/core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

…ode, ensuring consistent metadata availability (e.g., `cacheOutcome`) in both development and production environments
@alpavlove alpavlove force-pushed the fix/add-metadata-production-bug branch from 56ae8e5 to 2c63917 Compare December 5, 2024 13:36
@alpavlove alpavlove changed the title fix: make metadata available in production fix(core): make metadata available in production Dec 5, 2024
@redroot
Copy link

redroot commented Dec 9, 2024

@isy @JoviDeCroock any chance you guys could review this please?

@JoviDeCroock
Copy link
Collaborator

JoviDeCroock commented Dec 9, 2024

@redroot we remove the meta for a reason, it's meant to be for development - a better solution here might be to move it away from development metadata or for us to split up metadata in dev and not dev.

EDIT: I looked deeper into the few places where this transform is used and yeah, we should remove it entirely

@alpavlove
Copy link
Contributor Author

It seems I can not merge myself due to a lack of permissions. Could you do it, @JoviDeCroock?

@JoviDeCroock
Copy link
Collaborator

@alpavlove That's normal yes, you are not a collab/member

@JoviDeCroock JoviDeCroock merged commit 4d1b14e into urql-graphql:main Dec 9, 2024
7 checks passed
@alpavlove
Copy link
Contributor Author

@JoviDeCroock, unfortunately, it can't be released due to an error on CI
https://github.com/urql-graphql/urql/actions/runs/12234320213/job/34123275528

@alpavlove alpavlove deleted the fix/add-metadata-production-bug branch December 9, 2024 11:19
@github-actions github-actions bot mentioned this pull request Dec 9, 2024
@alpavlove
Copy link
Contributor Author

Thanks for getting this over the line, @JoviDeCroock!

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 this pull request may close these issues.

The metadata is still unavailable in production build.
3 participants