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: prefer warning over throwing when <PrismicLink> is given an invalid prop in development #157

Merged
merged 2 commits into from Jun 9, 2022

Conversation

angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Jun 9, 2022

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 changes <PrismicLink>'s development-only behavior to warn rather than throw when given an invalid Link field or Prismic document (in most cases; see the note below).

In addition to reducing the severity of an invalid field or document, this PR also fixes a bug where a valid unfilled Link field (i.e. a field that a content writer did not fill in) was treated as invalid. Unfilled Link fields are now treated as valid.

Note: <PrismicLink> will still throw if a link_type property is missing from the provided field prop value. link_type is required to detect the type of link and is populated even for unfilled Link fields.

(Thanks to @kb1995 for discovering this bug!)

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.

🐱

@angeloashmore angeloashmore marked this pull request as ready for review June 9, 2022 20:46
@github-actions
Copy link

github-actions bot commented Jun 9, 2022

size-limit report 📦

Path Size
dist/index.js 5.65 KB (+0.4% 🔺)
dist/index.cjs 7.18 KB (+0.31% 🔺)

@angeloashmore angeloashmore merged commit 4610658 into master Jun 9, 2022
@angeloashmore angeloashmore deleted the aa/fix-prismiclink-warning branch June 9, 2022 20:48
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.

None yet

1 participant