mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-15 20:57:56 +08:00
protect against reference detach (#1634)
This commit is contained in:
@@ -59,6 +59,11 @@ class Scatterplot extends React.PureComponent {
|
||||
/*
|
||||
Must be created for each canvas
|
||||
*/
|
||||
|
||||
// regl will create a top-level, full-screen canvas if we pass it a null.
|
||||
// canvas should never be null, so protect against that.
|
||||
if (!canvas) return {};
|
||||
|
||||
// setup canvas, webgl draw function and camera
|
||||
const regl = _regl(canvas);
|
||||
const drawPoints = _drawPoints(regl);
|
||||
@@ -175,9 +180,12 @@ class Scatterplot extends React.PureComponent {
|
||||
|
||||
setReglCanvas = (canvas) => {
|
||||
this.reglCanvas = canvas;
|
||||
this.setState({
|
||||
...Scatterplot.createReglState(canvas),
|
||||
});
|
||||
if (canvas) {
|
||||
// no need to update this state if we are detaching.
|
||||
this.setState({
|
||||
...Scatterplot.createReglState(canvas),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
getViewportDimensions = () => {
|
||||
|
||||
Reference in New Issue
Block a user