mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-29 00:47:01 +00:00
Protect against creating React editor without parent node
This commit is contained in:
parent
04989c6e1b
commit
3b8fabb227
@ -132,7 +132,13 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
|||||||
|
|
||||||
this.rootNode.innerHTML = "";
|
this.rootNode.innerHTML = "";
|
||||||
const monaco = await loadMonaco();
|
const monaco = await loadMonaco();
|
||||||
createCallback(monaco?.editor?.create(this.rootNode, options));
|
try {
|
||||||
|
createCallback(monaco?.editor?.create(this.rootNode, options));
|
||||||
|
} catch (error) {
|
||||||
|
// This could happen if the parent node suddenly disappears during create()
|
||||||
|
console.error("Unable to create EditorReact", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.rootNode.innerHTML) {
|
if (this.rootNode.innerHTML) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
Loading…
Reference in New Issue
Block a user