Skip to content

Commit

Permalink
fix: create unique Nodes (#22774)
Browse files Browse the repository at this point in the history
* fix: create unique Nodes

this used the same parent for every doc node, leading to `id` collisions for overloads with the same path. Also `lineNumber` seems broken from documentationjs, in a few cases it confusing different nodes for each other.

* fix test
  • Loading branch information
jquense authored Apr 9, 2020
1 parent 6c336d0 commit 1381a0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Object {
exports[`transformer-react-doc-gen: onCreateNode Complex example should handle typedefs should handle type applications 1`] = `
Object {
"children": Array [
"documentationJS node_1 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"},{\\"fieldName\\":\\"properties\\",\\"fieldIndex\\":0}] line 3--DocumentationJSComponentDescription--comment.description",
"documentationJS documentationJS node_1 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"}] line 12 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"},{\\"fieldName\\":\\"properties\\",\\"fieldIndex\\":0}] line 3--DocumentationJSComponentDescription--comment.description",
],
"commentNumber": null,
"description___NODE": "documentationJS node_1 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"},{\\"fieldName\\":\\"properties\\",\\"fieldIndex\\":0}] line 3--DocumentationJSComponentDescription--comment.description",
"id": "documentationJS node_1 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"},{\\"fieldName\\":\\"properties\\",\\"fieldIndex\\":0}] line 3",
"description___NODE": "documentationJS documentationJS node_1 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"}] line 12 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"},{\\"fieldName\\":\\"properties\\",\\"fieldIndex\\":0}] line 3--DocumentationJSComponentDescription--comment.description",
"id": "documentationJS documentationJS node_1 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"}] line 12 path #[{\\"name\\":\\"ObjectType\\",\\"kind\\":\\"typedef\\"},{\\"fieldName\\":\\"properties\\",\\"fieldIndex\\":0}] line 3",
"internal": Object {
"contentDigest": "content-digest",
"type": "DocumentationJs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ exports.onCreateNode = async ({ node, actions, ...helpers }) => {
const docSkeletonNode = {
commentNumber,
level,
id: createNodeId(docId(node.id, docsJson)),
id: createNodeId(docId(parent, docsJson)),
parent,
children: [],
internal: {
Expand Down

0 comments on commit 1381a0b

Please sign in to comment.