urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.54k stars 444 forks source link

feat: Add support for persisted documents via the `documentId` property #3515

Closed kitten closed 4 months ago

kitten commented 4 months ago

Summary

This PR adds support for persisted documents, as long as:

When we detect the documentId property on a document which has no definitions (either an empty array or not defined), we send a documentId instead of a query.

This is similar to Automatic Persisted Queries (APQs), but those require the @urql/exchange-persisted exchange, to facilitate generating persisted queries on the fly (as per the spec) and retrying them.

This is to comply with: https://github.com/graphql/graphql-over-http/pull/264

Set of changes

changeset-bot[bot] commented 4 months ago

🦋 Changeset detected

Latest commit: 33bf2f37b1d03b7f85f307de1f7a0c59798a050f

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

kitten commented 4 months ago

Merging since it technically doesn't matter when we land this exactly