n3m3sis00 / phylo-react

React component library for Phylogenetic Analysis
https://n3m3sis00.github.io/phylo-react/
2 stars 1 forks source link

App crashes when the Tree String is not valid #13

Open n3m3sis00 opened 4 years ago

n3m3sis00 commented 4 years ago

Create a tree validation logic and show error for invalid tree.

cmdcolin commented 4 years ago

Looks like the crash is from line 88

  .text(d => d.data.name.replace(/_/g, ' '))     

A simple fix would be to make it

  .text(d => (d.data.name||'').replace(/_/g, ' '))     

Note, making the code typescript can help fix our assumptions about undefined states. If you have interest in making the code typescript we can look into this