Skip to content

Commit

Permalink
remove oldProps comaprisons for temporalConfidence
Browse files Browse the repository at this point in the history
  • Loading branch information
eharkins committed Apr 15, 2020
1 parent 4de5ef3 commit 0713e69
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/tree/reactD3Interface/change.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,19 @@ export const changePhyloTreeViaPropsComparison = (mainTree, phylotree, oldProps,
}


/* confidence intervals (on means in the SVG, display means shown in the sidebar) */
if (oldProps.temporalConfidence.display === true && newProps.temporalConfidence.display === false) {
/* confidence intervals (on means in the SVG, display means shown in the sidebar)
This block used to include comparisons of oldProps to newProps
(see https://reactjs.org/docs/react-component.html#componentdidupdate for why it's good to do that)
but this was preventing the confidences from being added in some cases. This is probably because some intermediate
event set temporalConfidence.on or temporalConfidence.display to true without triggering the tree's
componentDidUpdate, and then when componentDidUpdate was triggered and this comparison was thereby made,
oldProps.temporalConfidence.on was already set to true, so confidences were not being added. Another way
to solve this would be to investigate that event and find out why it didn't trigger componentDidUpdate if it indeed was meant to. */
if (newProps.temporalConfidence.display === false) {
args.removeConfidences = true;
} else if (oldProps.temporalConfidence.on === true && newProps.temporalConfidence.on === false) {
} else if (newProps.temporalConfidence.on === false) {
args.removeConfidences = true;
} else if (newProps.temporalConfidence.display === true && oldProps.temporalConfidence.on === false && newProps.temporalConfidence.on === true) {
} else if (newProps.temporalConfidence.display === true && newProps.temporalConfidence.on === true) {
args.showConfidences = true;
}

Expand Down

0 comments on commit 0713e69

Please sign in to comment.