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.

Cannot reduce marks when marks are not present

See original GitHub issue

I am retrieving a Rich Text field from my Contentful model and since I have not introduced any types into it, the GraphQL blows up when I try and retrieve them (because there are none). If I remove the marks { type } JSON blob part, the GraphQL executes successfully, but the rich-text-react-renderer is expecting to have an existing object called marks to apply some styling. My surprise is that there’s no other way for me to create React components out of a JSON blob without marks. I would expect that if part of the document that I am passing to the rich-text-react-renderer component doesn’t contain marks, for it not to blow up and show the content without any marks…

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
vpelkonencommented, Nov 26, 2019

I was able to circumvent the same error by taking only the JSON data through GraphQL:

someRichTextNode {
  json
}

…and passing the JSON through to documentToReactComponents:

documentToReactComponents(someRichTextNode.json)

Source: https://www.contentful.com/developers/docs/tutorials/general/rich-text-and-gatsby/

1reaction
rmcsharrycommented, Oct 21, 2019

@cribbles you said:

For rich text markup, the marks property is expected to present on text nodes even when there are no marks applied to the text

But that is NOT happening.

For example, create a RTN and just type some text. There is no marks property created. Then go back and make the text italic or bold. Now there is a marks property.

So it seems the user has to do some kind of formatting otherwise there is no marks property. Is this because Contentful is not creating the marks property or is it because the GraphQL cannot see it if no formatting was applied?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change the Type of Mark in the View - Tableau Help
This article describes how to change the type of marks used in the view, and explains the different types of marks available. For...
Read more >
I'm getting an error that the machine cannot read the cut ...
When Design Space tells you the machine cannot read the cut sensor marks, this means the image you are trying to cut is...
Read more >
Crop Marks Cannot be Read - Download Center - Roland DG
Crop marks may not be read if the material has creases or wrinkles. ... If the size is expanded or reduced when printing,...
Read more >
Marks - Cengage Platform Help
If shown, marks indicate whether the most recent answer you submitted was correct or incorrect. Note Marks are never shown for short answer,...
Read more >
Stretch marks: Why they appear and how to get rid of them
Like any scar, stretch marks are permanent, but treatment may make them less noticeable. Treatment can also help alleviate the itch.
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