Fixes #1092. The issue describes a different bug (which I assume was fixed somewhere?) but in trying to reproduce it I caught a different bug. The bug I saw was that pressing undo would get rid of the graph, but not close the graph editor. There would be no graph, but because the graph editor is designed to create a new graph when it sees the graph editor is open, it would just create a new graph. I chose to solve this by adding a useEffect that would check in the Mito component when the graphDataArray changed, and if the graphDataArray was empty but the graph taskpane was open, it just closes that taskpane.
Fixes #1092. The issue describes a different bug (which I assume was fixed somewhere?) but in trying to reproduce it I caught a different bug. The bug I saw was that pressing undo would get rid of the graph, but not close the graph editor. There would be no graph, but because the graph editor is designed to create a new graph when it sees the graph editor is open, it would just create a new graph. I chose to solve this by adding a
useEffect
that would check in theMito
component when thegraphDataArray
changed, and if the graphDataArray was empty but the graph taskpane was open, it just closes that taskpane.