Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: throw when <PrismicLink>'s field or document prop value is missing required properties #153

Merged
merged 4 commits into from
May 26, 2022

Conversation

angeloashmore
Copy link
Member

Types of changes

  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

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

When <PrismicLink> receives a field or document prop value with missing required properties, an error is thrown with a helpful message. It also logs the invalid prop value to the console before throwing for easier debugging.

See the full message in messages/missing-link-properties.md.

For more details, see #150.

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

🦉

@codecov-commenter
Copy link

Codecov Report

Merging #153 (949a83d) into master (c21caf0) will increase coverage by 0.00%.
The diff coverage is 91.66%.

@@           Coverage Diff           @@
##           master     #153   +/-   ##
=======================================
  Coverage   91.61%   91.61%           
=======================================
  Files          18       18           
  Lines         322      334   +12     
  Branches       77       84    +7     
=======================================
+ Hits          295      306   +11     
  Misses          5        5           
- Partials       22       23    +1     
Impacted Files Coverage Δ
src/PrismicLink.tsx 94.00% <91.66%> (-0.74%) ⬇️

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 c21caf0...949a83d. Read the comment docs.

@github-actions
Copy link

size-limit report 📦

Path Size
dist/index.js 5.63 KB (+2.86% 🔺)
dist/index.cjs 7.16 KB (+2.35% 🔺)

@angeloashmore angeloashmore merged commit 349529e into master May 26, 2022
@angeloashmore angeloashmore deleted the aa/prismiclink-missing-properties branch May 26, 2022 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants