You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 3, 2019. It is now read-only.
Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "3hWjFg8z7faY" doesnt.
GraphQL does not like nodes that start with numbers. The library you based this off of has a way of doing it but could you just prepend a string "id" when you create the nodes.
here is how the other library attacks it
// This allows you to map your data to data that GraphQL likes:
// 1. Turn your lists into actual arrays
// 2. Fix keys that GraphQL hates. It doesn't allow number keys
// like "0", you'll get this error pretty often:
// Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "0" does not
// 3. Remove stuff you don't need.
//
// Feel free to mutate, we sent you a copy anyway.
map: node => {
// fix keys graphql hates
node.nineteenEightyFive = node['1985']
delete node['1985']
// convert a child list to an array:
return node.sessions = Object.keys(node.sessions).map(key => {
return { _key: key, session: node.sessions[key] }
})
// finally, return the node
return node
},
},
The text was updated successfully, but these errors were encountered:
changing the id's of all my firestore records (not feasible and breaks one of firestores key features AutoID.
Updating this part of the code to start each name with a character for (let doc of snapshot.docs) { const contentDigest = getDigest(doc.id); <--- here const node = createNode( Object.assign({}, map(doc.data()), { id: doc.id, <--- here parent: null, children: [], internal: { type, contentDigest, }, }) );
I pushed a branch using your suggested method 2 here. Please try it out.
As of this moment, I'm hesitant to merge to master branch as it may cause breaking changes to those that's actually using hardcoded ID. Due to shortage of resources we can't look into this issue deeply. We're happy to accept PRs.
The Error
Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "3hWjFg8z7faY" doesnt.
GraphQL does not like nodes that start with numbers. The library you based this off of has a way of doing it but could you just prepend a string "id" when you create the nodes.
here is how the other library attacks it
The text was updated successfully, but these errors were encountered: