PrismicLink output if not enough attributes are passed in
See original GitHub issueIs your feature request related to a problem? Please describe.
I created a Link
-Field in Prismic CMS and wanted to use PrismicLink
in order to display it.
In my case it could be a document, external or media link.
I used this code to render the PrismicLink
:
<PrismicLink
field={item.link}
linkResolver={linkResolver}
>
{item.text}
</PrismicLink>
I expect this to work but there was no error and no link was rendered. (It just returned null
I think)
After that, I added more fields to my GraphQL query and then it worked. So, the component needed some more attributes in order to work correctly.
Describe the solution you’d like
I would like the PrismicLink
component to output a message like “uid, id, lang, …” are needed on the link field in order to work.
Or at least some feedback from the component and not just nothing.
Additional context
The link fields I selected when it didn’t work: link_type
.
The link fields I selected when it finally worked:
link_type, url, uid, id, lang, type, target
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
React PrismicLink component causing error when not set (on ...
I am using Prismic in combination with Next.js to build a marketing website. After making some changes to the content from the Prismic...
Read more >Attributes required not met, can still use weapon : r/Eldenring
I found a bow that needs a certain amount of str and dex and I don't have either high enough, yet im still...
Read more >Can't pass props with excess properties · Issue #15463 - GitHub
Type '{ property1: string; property2: number; }' is not assignable to type 'IntrinsicAttributes & AnotherComponentProps'. Property 'property2' ...
Read more >Elden Ring Attribute Scaling explained | Eurogamer.net
How Attribute Scaling works in Elden Ring · The value on the left is the weapon's base damage (115 in the image), which...
Read more >Elden Ring: How To Raise ALL STATS - YouTube
How to raise all stats in Elden Ring by +5 using Godrick the Grafteds Great Rune. This is how you activate the rune...
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 FreeTop 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
Top GitHub Comments
https://github.com/prismicio/prismic-helpers/pull/51 was merged and released 🎉 This one should land soon too!
Hi @alexanderbluhm, thanks for reporting this bug.
v2.4.1
includes a development-only check for missing Link field properties. It will throw an error letting you know the field is missing properties and links to a document with an explanation. See the document here: https://github.com/prismicio/prismic-react/blob/1eb04d88a72f436ac7586625716ff6c9fe337949/messages/missing-link-properties.mdYou can see more details on the changes in the PR here: #153.
Update to the latest version of
@prismicio/react
to benefit from the development check:If you have any questions, feel free to post them here and I will help. Thanks! 🙂