Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(gatsby-source-strapi): fetching content twice (via relationships) fails to transform to Markdown #412

Open
laurenskling opened this issue Mar 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@laurenskling
Copy link
Contributor

Describe the bug

It used to work TM.
One of my websites is failing to parse specific content to Markdown. I narrowed it down to happen when this entry is selected in a relation in a DZ component (that might matter). When I do not select the entry in that manyToMany relationship, the text gets converted to Markdown again.

To Reproduce

Steps to reproduce the behavior:

  1. Have a Questions model
  2. Have a FAQ component with a manyToMany to the Questions
  3. Have a DZ with this FAQ Component
  4. See error

The Node should contain
content: { medias: [], data___NODE: '6a0df7ef-2907-52e4-80dd-147f931ace96' },
But contains:

    data: "My content",
    medias: []
  },

Expected behavior

Rich text should always be available in Markdown

System Info

System:
OS: macOS 12.6
CPU: (8) arm64 Apple M2
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.15.0 - /var/folders/50/3fndm5d13gs_kr96nwxpxd9c0000gn/T/yarn--1679606202261-0.9668410895557038/node
Yarn: 1.22.19 - /var/folders/50/3fndm5d13gs_kr96nwxpxd9c0000gn/T/yarn--1679606202261-0.9668410895557038/yarn
npm: 9.5.0 - /usr/local/bin/npm
Languages:
Python: 3.10.9 - /usr/local/bin/python
Browsers:
Chrome: 111.0.5563.110
Safari: 16.0

@laurenskling laurenskling added the bug Something isn't working label Mar 23, 2023
@laurenskling
Copy link
Contributor Author

When I hit this is pretty specific. But I'm afraid it always happens whenever you fetch the same content twice (via a relation).

@laurenskling
Copy link
Contributor Author

I just "fixed" my use case by not fetching the full relationship, only the id

(note to the rest of the world: ?populate[components][populate][questions][fields][0]=id (with a [0]) returns only the id and no attributes, ?populate[components][populate][questions][fields]=id (without the [0]) returns all the attributes as well. I'm pretty sure when I wrote these queries that wasn't the case, but here we are.)

This doesn't make this bug go away. Fetching richtext in a relationship, while also fetching that content directly, will break the richtext.

@laurenskling laurenskling changed the title bug(gatsby-source-strapi): richtext in a relationship in a DZ component fails to transform to Markdown bug(gatsby-source-strapi): fetching content twice (via relationships) fails to transform to Markdown Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant