PrismicLink: Missing Link Properties error message isn't helpful enough
See original GitHub issueIs your feature request related to a problem? Please describe.
I would like to suggest a feature of making the PrismicLink feedback slightly more verbose message for the Missing Link information message from the CLI.
Currently when there is an error the message is like this:
[PrismicLink] The provided field is missing required properties to properly render a link. The link may not render correctly. For more details, see https://prismic.dev/msg/react/v2.4.2/missing-link-properties { link_type: 'Any' }
First time seeing it, but also I have no idea which link. Especially when there is quite a lot of them…
Describe the solution you’d like
I would like to maybe see the extended information in that object maybe showing the url / uid of the document in the local CLI environment (not sure if these pop up in the browser console.)
Basically: { link_type: 'Any' , uid: 'xyz-uid-for-a-document'}
is a lot easier to debug.
Describe alternatives you’ve considered
None.
Additional context
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React PrismicLink component causing error when not set (on ...
Error: [PrismicLink] The provided field is missing required properties to properly render a link. The link may not render.
Read more >Preview feature? · Issue #22 · prismicio/prismic-gatsby - GitHub
Is there any way to get Prismic's in-situ preview feature working with a (deployed) Gatsby site?
Read more >Build Flexible CMS Layouts with Slice Machine
The modern web is modular, and Prismicio's Slice Machine brings block-based editing to the CMS. In this episode, Lucie Haberer will teach us...
Read more >prismicio/prismic-react Issues - Giters
Provide feedback when a `<PrismicLink>` component receives an invalid value ... PrismicLink: Missing Link Properties error message isn't helpful enough.
Read more >Missing release entry for 1.3.0,about prismicio/prismic-react ...
... Incompatible with Jest using ESM (`Jest encountered an unexpected token`) HOT 1; PrismicLink: Missing Link Properties error message isn't helpful enough ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also the Link class is a whole lot better than before 😃 💯
Hey @ReeceM, it turns out there was a bug in
<PrismicLink>
! The test to check for the warning on empty links was written incorrectly (probably an accident from copy and pasting part of the test while it was being written).This means your code is probably correct and it was just an issue within
<PrismicLink>
.It should be fixed as of
v2.4.4
, which you can upgrade to using the following command:If you want to see more details on the fix, you can check out the PR here: #163.
Thanks for finding this issue and reporting it! 🙂
That’s right; the
isFilled.link()
helper tells you if a Link field is filled or not. All Link fields, even empty ones, are objects containing at least alink_type
property. This means something likeslice?.primary?.secondaryLink
will always returntrue
, even if the field is empty.isFilled.link()
is used inside<PrismicLink>
, so you shouldn’t need to use it manually in your code unless you want to conditionally render content around the link, such as a wrapping<div>
.Let me know if you have any other questions and I’ll try to answer them.