fix: prefer warning over throwing when <PrismicLink>
is given an invalid prop in development
#157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Types of changes
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 alink_type
property is missing from the providedfield
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:
🐱