hydrogen
hydrogen copied to clipboard
Add a PoC implementation of the new GraphQL defer directive on the SFAPI
This is a proof of concept implementation of the new GraphQL defer directive on the SFAPI.
A few notes:
- It requires the defer directive developer preview: https://shopify.dev/docs/api/release-notes/developer-previews#defer-directive-developer-preview
- It uses the
@shopify/storefront-api-clientpackage, because hydrogen's built in api client does not yet support defer/streaming. - At runtime, it parses the GraphQL query, finds the
deferdirectives, and replaces the associated fragment properties with inline promises that resolve after the data is available. - It only supports top level deferred properties. Not nested.