Closed bosbode closed 1 year ago
Hi @bosbode, you are correct; Slice Machine gives the wrong code snippet for Key Text fields.
As you saw in the error message, <PrismicText>
only accepts Rich Text or Title field values. Key Text is already a plain string, so it can be used directly.
The Slice Machine team is fixing this error and a new version of Slice Machine will be released soon. The code snippet will look like this after the fix:
{slice.primary.buttonText}
Thanks for reporting! 🙂
When creating a new slice and adding a Key Text. I get the following error when trying to preview it:
Error: [PrismicText] The "field" prop only accepts a Rich Text or Title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without.
I'm just following this YouTube video .
Edit: It works when using keyText in a span, like seen in the instructions. The code snippet in slicemachine doesn't reflect this.
/* import { PrismicText } from '@prismicio/react' */ <PrismicText field={slice.primary.buttonText} />