make frontend more resilient to a broken graph

pull/1/head
Tao Bror Bojlén 2019-02-20 21:27:47 +00:00
rodzic dfaf15fb51
commit f4044a4cd7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: C6EC7AAB905F9E6F
1 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -64,9 +64,12 @@ class GraphImpl extends React.Component {
}
componentDidUpdate() {
const sigma = this.sigmaComponent.current.sigma;
sigma.graph.nodes().map(this.colorNodes);
sigma.refresh();
const sigma = this.sigmaComponent && this.sigmaComponent.current.sigma;
// Check if sigma exists s.t. nothing breaks if the graph didn't load (for whatever reason)
if (sigma) {
sigma.graph.nodes().map(this.colorNodes);
sigma.refresh();
}
}
onClickNode = (e) => {