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(PrismicLink): do not warn about missing field properties if the Link field is empty #163

Closed angeloashmore closed 1 year ago

angeloashmore commented 1 year ago

Types of changes

Description

This PR fixes a bug in <PrismicLink> where it logged a console warning about missing Link field properties when given an empty Link field value. Empty link values are valid and should not trigger the warning.

The issue was unknown because the test to check this exact case was written incorrectly (see the fix).

Fixes #161

Thanks to @ReeceM for uncovering the issue!

Checklist:

🐈

codecov-commenter commented 1 year ago

Codecov Report

Merging #163 (6db944e) into master (5be1649) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #163      +/-   ##
==========================================
+ Coverage   91.61%   91.64%   +0.02%     
==========================================
  Files          18       18              
  Lines         334      335       +1     
  Branches       84       85       +1     
==========================================
+ Hits          306      307       +1     
  Misses          5        5              
  Partials       23       23              
Impacted Files Coverage Ξ”
src/PrismicLink.tsx 94.11% <100.00%> (+0.11%) :arrow_up:

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 5be1649...6db944e. Read the comment docs.

github-actions[bot] commented 1 year ago

size-limit report πŸ“¦

Path Size
dist/index.js 5.66 KB (+0.16% πŸ”Ί)
dist/index.cjs 7.19 KB (+0.13% πŸ”Ί)