question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PrismicLink output if not enough attributes are passed in

See original GitHub issue

Is 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:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lihbrcommented, Jun 9, 2022

https://github.com/prismicio/prismic-helpers/pull/51 was merged and released 🎉 This one should land soon too!

1reaction
angeloashmorecommented, May 26, 2022

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.md

You 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:

npm i @prismicio/react@latest

If you have any questions, feel free to post them here and I will help. Thanks! 🙂

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found