prismicio / prismic-react

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

fix: throw a helpful error if `<PrismicText>` receives an incorrect field value #152

Closed angeloashmore closed 1 year ago

angeloashmore commented 1 year ago

Types of changes

Description

This PR adds a development-only error handler to the <PrismicText> component.

When <PrismicText> is given a field value not from a Rich Text or Title field, an error is thrown with a helpful message.

See the full message in messages/prismictext-is-only-for-rich-text-fields.md.

For more details, see #149.

Checklist:

πŸš“

codecov-commenter commented 1 year ago

Codecov Report

Merging #152 (aaca585) into master (c6e3a12) will decrease coverage by 0.80%. The diff coverage is 40.00%.

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
- Coverage   91.79%   90.99%   -0.81%     
==========================================
  Files          18       18              
  Lines         317      322       +5     
  Branches       75       77       +2     
==========================================
+ Hits          291      293       +2     
- Misses          5        6       +1     
- Partials       21       23       +2     
Impacted Files Coverage Ξ”
src/PrismicText.tsx 76.92% <40.00%> (-23.08%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update c6e3a12...aaca585. Read the comment docs.

github-actions[bot] commented 1 year ago

size-limit report πŸ“¦

Path Size
dist/index.js 5.47 KB (+3% πŸ”Ί)
dist/index.cjs 7 KB (+2.35% πŸ”Ί)