Add a safety check before getting clientHeight (#6923)

Seeing an intermittent repro of the `current` nodes of the sql editor and south pane refs returning null. Adding a safety check for both nodes.
This commit is contained in:
Christine Chambers
2019-02-20 14:31:28 -08:00
committed by GitHub
parent 25ec00b3c6
commit c04c0cd8f0
2 changed files with 2 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ export class SouthPane extends React.PureComponent {
}
// One layer of abstraction for easy spying in unit tests
getSouthPaneHeight() {
return this.southPaneRef.current.clientHeight;
return this.southPaneRef.current ? this.southPaneRef.current.clientHeight : 0;
}
switchTab(id) {
this.props.actions.setActiveSouthPaneTab(id);

View File

@@ -122,7 +122,7 @@ class SqlEditor extends React.PureComponent {
}
// One layer of abstraction for easy spying in unit tests
getSqlEditorHeight() {
return this.sqlEditorRef.current.clientHeight;
return this.sqlEditorRef.current ? this.sqlEditorRef.current.clientHeight : 0;
}
// Return the heights for the ace editor and the south pane as an object
// given the height of the sql editor, north pane percent and south pane percent.