Describe the bug
When stating more lists in gatsby-config, the nodes created do not reflect actual fields. The first list has correct fields, the successors contain fields of the previous lists.
This happens only in Gatsby 4.0, in Gatsby 2.0 is everything ok.
To Reproduce
Upgrade to Gatsby 4.0
Define more lists in gatsby-config
Run develop
Check GraphiQL
Expected behavior
Lists' fields should match the state in the source. Instead, first list is ok, the second list contains fields from the first list, etc.
Desktop (please complete the following information):
Gatsby 4.0
Additional context
I've tested it in Gatsby 2.0, it works well there.
Issue appears in Gatsby 4.0.
SOLUTION
make the nodeId more unique.
Current code in resource.js:
id: helpers.createNodeId(data.id),
Change to:
const postNodeType = ${site.name}${normalizedListName}ListItem;
id: helpers.createNodeId(${postNodeType}-${data.id}),
ADDITIONAL MODIFICATION
In resource.js, I have also bound the entry get() with the createNodes loop. Now, the createNodes fires only when get() is resolved.
Describe the bug When stating more lists in gatsby-config, the nodes created do not reflect actual fields. The first list has correct fields, the successors contain fields of the previous lists. This happens only in Gatsby 4.0, in Gatsby 2.0 is everything ok.
To Reproduce
Expected behavior Lists' fields should match the state in the source. Instead, first list is ok, the second list contains fields from the first list, etc.
Desktop (please complete the following information):
Additional context I've tested it in Gatsby 2.0, it works well there. Issue appears in Gatsby 4.0.
SOLUTION
make the nodeId more unique.
Current code in resource.js:
id: helpers.createNodeId(data.id),
Change to: const postNodeType =
${site.name}${normalizedListName}ListItem
; id: helpers.createNodeId(${postNodeType}-${data.id}
),ADDITIONAL MODIFICATION
In resource.js, I have also bound the entry get() with the createNodes loop. Now, the createNodes fires only when get() is resolved.
remove:
const entry = await request.get();
add: