prismicio / prismic-react

React components and hooks to fetch and present Prismic content
https://prismic.io/docs/technologies/homepage-reactjs
Apache License 2.0
154 stars 40 forks source link

<SliceZone> does not work with GraphQL API responses #139

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

<SliceZone> expects a list of Slice objects to render, each with a slice_type property. This property is used to determine which component to render.

Prismic's GraphQL API uses the type field rather than slice_type. The component should be updated to support the GraphQL-style object.

Versions

Steps to reproduce

  1. Query a Slice Zone from the GraphQL API. Include the type field.
  2. Send that data to <SliceZone>
  3. See that it cannot determine the Slice's type.

What is expected?

It works the same as when querying content from the Rest API.

What is actually happening?

It does not render the correct component for each Slice.

angeloashmore commented 2 years ago

Fixed in #141