gatsby-uc / gatsby-uc/plugins

bug(gatsby-source-strapi): Relations are not picked up if they are named "parent" or "children"

Open
#339 3 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
57
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Since "parent" and "children" are reserved keywords in gatsby, this plugin automatically appends "strapi_" to the relation name. Since the relations are now named "strapi_parent" and "strapi_children" the code on this line doesn't work, https://github.com/strapi/gatsby-source-strapi/blob/2a60320b16ae6520617d743158c433d384dbd155/src/download-media-files.js#L117, since the relations on the strapi schema are named just "parent" and "children", but attributeName is "strapi_parent" and "strapi_children".
This problem is related to the other issue I have with relations: https://github.com/strapi/gatsby-source-strapi/issues/308, because without changing the code to `schema.schema.attributes[attributeName.replace('strapi_', '')]` the fix I illustrated in the other issue doesn't work because the fields generated from this plugin and the schema on strapi are different

Contributor guide

Open the contributing guide

Research direction

Start at src/download-media-files.js line 117 and compare the generated relation names with the Strapi schema attributes. Read issue #308 for the related relation behavior, then verify that relations named parent and children are picked up despite their strapi_ prefixes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.