×
I truncated the file paths for privacy reasons. I am using react-mindmap with redux:
render (
<ConceptMap nodes={store.getState().graphModel.nodes.all} connections={store.getState().graphModel.connections} />,
document.getElementById('GraphBox')
);
However, when I try to generate graphs, I get this error:
Unhandled Rejection (TypeError): Cannot read property 'x' of undefined
▼ 50 stack frames were expanded.
SVGPathElement.r
/react-mindmap/dist/index.js:1
SVGPathElement.
/react-mindmap/dist/index.js:1
et.Mi [as each]
/react-mindmap/dist/index.js:1
et.Ti [as attr]
/react-mindmap/dist/index.js:1
n.onTick
/react-mindmap/dist/index.js:1
n.value
/react-mindmap/dist/index.js:1
n.value
/react-mindmap/dist/index.js:1
The nodes themselves seem to be generated fine. When I log the nodes prop of the generated graph object, I get, for example:
"[{"text":"Hello Kitty","url":"http://en.wikipedia.org/wiki/Hello_Kitty","note":"Hello Kitty (Japanese: ハロー・キティ, Hepburn: Harō Kiti), (full name: Kitty White (キティ・ホワイト, Kiti Howaito)) is a fictional character produced by the Japanese company Sanrio, created by Yuko Shimizu and currently designed by Yuko Yamaguchi.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Hello_Kitty\">Hello Kitty <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":159,"height":61,"nodesWidth":0,"nodesHeight":0,"index":0,"x":67.1931607380315,"y":-430.8585618641549,"vy":0.005475231066065419,"vx":-0.16385505582576973},{"text":"Sanrio","url":"http://en.wikipedia.org/wiki/Sanrio","note":"Sanrio Co., Ltd. (株式会社サンリオ, Kabushikigaisha Sanrio) is a Japanese company that designs, licenses and produces products focusing on the kawaii (cute) segment of Japanese popular culture.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Sanrio\">Sanrio <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":117,"height":61,"nodesWidth":0,"nodesHeight":0,"index":1,"x":109.81685930214637,"y":-235.45711663168223,"vy":-0.03301944998594324,"vx":0.013519864709321162},{"text":"Kitty","url":"http://en.wikipedia.org/wiki/Kitty","note":"Kitty or Kittie may refer to:","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Kitty\">Kitty <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":105,"height":61,"nodesWidth":0,"nodesHeight":0,"index":2,"x":-123.02180959822738,"y":-491.81785760230156,"vy":-0.01657491341339033,"vx":0.03924413758929733},{"text":"Yuko","url":"http://en.wikipedia.org/wiki/Yuko","note":"Yuko may refer to:","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Yuko\">Yuko <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":106,"height":61,"nodesWidth":0,"nodesHeight":0,"index":3,"x":257.7806109357365,"y":-369.97417845126284,"vy":-0.015398561259602124,"vx":0.021645928290699043},{"text":"Fairyland","url":"http://en.wikipedia.org/wiki/Fairyland","note":"Fairyland, in folklore, is the fabulous land or abode of fairies or fays.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Fairyland\">Fairyland <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":144,"height":61,"nodesWidth":0,"nodesHeight":0,"index":4,"x":-80.67139825231155,"y":-296.3249364246367,"vy":-0.05314088879672288,"vx":0.012515393724210238},{"text":"Okamura","url":"http://en.wikipedia.org/wiki/Okamura","note":"Okamura (written:岡村, meaning \"hill, village\") is a Japanese surname, referring to:","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Okamura\">Okamura <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":141,"height":61,"nodesWidth":0,"nodesHeight":0,"index":5,"x":215.05913660358152,"y":-565.4270795870362,"vy":-0.05943208342659245,"vx":0.039727540540024454}]"
So I can see that react-mindmap seems to have written to the Redux store, adding fields like "html" to the original nodes object I passed in. Similarly, for the connections prop:
"[{"source":{"text":"Hello Kitty","url":"http://en.wikipedia.org/wiki/Hello_Kitty","note":"Hello Kitty (Japanese: ハロー・キティ, Hepburn: Harō Kiti), (full name: Kitty White (キティ・ホワイト, Kiti Howaito)) is a fictional character produced by the Japanese company Sanrio, created by Yuko Shimizu and currently designed by Yuko Yamaguchi.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Hello_Kitty\">Hello Kitty <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":159,"height":61,"nodesWidth":0,"nodesHeight":0,"index":0,"x":67.1931607380315,"y":-430.8585618641549,"vy":0.005475231066065419,"vx":-0.16385505582576973},"target":{"text":"Sanrio","url":"http://en.wikipedia.org/wiki/Sanrio","note":"Sanrio Co., Ltd. (株式会社サンリオ, Kabushikigaisha Sanrio) is a Japanese company that designs, licenses and produces products focusing on the kawaii (cute) segment of Japanese popular culture.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Sanrio\">Sanrio <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":117,"height":61,"nodesWidth":0,"nodesHeight":0,"index":1,"x":109.81685930214637,"y":-235.45711663168223,"vy":-0.03301944998594324,"vx":0.013519864709321162},"index":0},{"source":{"text":"Hello Kitty","url":"http://en.wikipedia.org/wiki/Hello_Kitty","note":"Hello Kitty (Japanese: ハロー・キティ, Hepburn: Harō Kiti), (full name: Kitty White (キティ・ホワイト, Kiti Howaito)) is a fictional character produced by the Japanese company Sanrio, created by Yuko Shimizu and currently designed by Yuko Yamaguchi.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Hello_Kitty\">Hello Kitty <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":159,"height":61,"nodesWidth":0,"nodesHeight":0,"index":0,"x":67.1931607380315,"y":-430.8585618641549,"vy":0.005475231066065419,"vx":-0.16385505582576973},"target":{"text":"Kitty","url":"http://en.wikipedia.org/wiki/Kitty","note":"Kitty or Kittie may refer to:","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Kitty\">Kitty <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":105,"height":61,"nodesWidth":0,"nodesHeight":0,"index":2,"x":-123.02180959822738,"y":-491.81785760230156,"vy":-0.01657491341339033,"vx":0.03924413758929733},"index":1},{"source":{"text":"Hello Kitty","url":"http://en.wikipedia.org/wiki/Hello_Kitty","note":"Hello Kitty (Japanese: ハロー・キティ, Hepburn: Harō Kiti), (full name: Kitty White (キティ・ホワイト, Kiti Howaito)) is a fictional character produced by the Japanese company Sanrio, created by Yuko Shimizu and currently designed by Yuko Yamaguchi.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Hello_Kitty\">Hello Kitty <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":159,"height":61,"nodesWidth":0,"nodesHeight":0,"index":0,"x":67.1931607380315,"y":-430.8585618641549,"vy":0.005475231066065419,"vx":-0.16385505582576973},"target":{"text":"Yuko","url":"http://en.wikipedia.org/wiki/Yuko","note":"Yuko may refer to:","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Yuko\">Yuko <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":106,"height":61,"nodesWidth":0,"nodesHeight":0,"index":3,"x":257.7806109357365,"y":-369.97417845126284,"vy":-0.015398561259602124,"vx":0.021645928290699043},"index":2},{"source":{"text":"Hello Kitty","url":"http://en.wikipedia.org/wiki/Hello_Kitty","note":"Hello Kitty (Japanese: ハロー・キティ, Hepburn: Harō Kiti), (full name: Kitty White (キティ・ホワイト, Kiti Howaito)) is a fictional character produced by the Japanese company Sanrio, created by Yuko Shimizu and currently designed by Yuko Yamaguchi.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Hello_Kitty\">Hello Kitty <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":159,"height":61,"nodesWidth":0,"nodesHeight":0,"index":0,"x":67.1931607380315,"y":-430.8585618641549,"vy":0.005475231066065419,"vx":-0.16385505582576973},"target":{"text":"Fairyland","url":"http://en.wikipedia.org/wiki/Fairyland","note":"Fairyland, in folklore, is the fabulous land or abode of fairies or fays.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Fairyland\">Fairyland <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":144,"height":61,"nodesWidth":0,"nodesHeight":0,"index":4,"x":-80.67139825231155,"y":-296.3249364246367,"vy":-0.05314088879672288,"vx":0.012515393724210238},"index":3},{"source":{"text":"Hello Kitty","url":"http://en.wikipedia.org/wiki/Hello_Kitty","note":"Hello Kitty (Japanese: ハロー・キティ, Hepburn: Harō Kiti), (full name: Kitty White (キティ・ホワイト, Kiti Howaito)) is a fictional character produced by the Japanese company Sanrio, created by Yuko Shimizu and currently designed by Yuko Yamaguchi.","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Hello_Kitty\">Hello Kitty <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":159,"height":61,"nodesWidth":0,"nodesHeight":0,"index":0,"x":67.1931607380315,"y":-430.8585618641549,"vy":0.005475231066065419,"vx":-0.16385505582576973},"target":{"text":"Okamura","url":"http://en.wikipedia.org/wiki/Okamura","note":"Okamura (written:岡村, meaning \"hill, village\") is a Japanese surname, referring to:","html":"<a id=\"node-undefined\" href=\"http://en.wikipedia.org/wiki/Okamura\">Okamura <img class=\"mindmap-emoji\" title=\"\" src=\"https://assets-cdn.github.com/images/icons/emoji/unicode/1f517.png\"></a>","nodesHTML":"","width":141,"height":61,"nodesWidth":0,"nodesHeight":0,"index":5,"x":215.05913660358152,"y":-565.4270795870362,"vy":-0.05943208342659245,"vx":0.039727540540024454},"index":4}]"
So what could be causing this error?