hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

Add a PoC implementation of the new GraphQL defer directive on the SFAPI

Open blittle opened this issue 1 year ago • 0 comments

This is a proof of concept implementation of the new GraphQL defer directive on the SFAPI.

A few notes:

  1. It requires the defer directive developer preview: https://shopify.dev/docs/api/release-notes/developer-previews#defer-directive-developer-preview
  2. It uses the @shopify/storefront-api-client package, because hydrogen's built in api client does not yet support defer/streaming.
  3. At runtime, it parses the GraphQL query, finds the defer directives, and replaces the associated fragment properties with inline promises that resolve after the data is available.
  4. It only supports top level deferred properties. Not nested.

blittle avatar Feb 28 '24 22:02 blittle