question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'dispose' of undefined

See original GitHub issue

Hi, I’ve been playing around with your React integration of Monaco. Thanks for all your hard work in doing this!

I ran into a few problems when the editor unmounts. I’m creating the editor within a functional component and sometimes when I click something that would cause the editor to unmount (I presume), I get errors such as:

  TypeError: Cannot read property 'updateOptions' of undefined
(anonymous function)
src/afw_app/admin/node_modules/@monaco-editor/react/lib/Editor/Editor.js:166
  163 |   monacoRef.current.editor.setTheme(theme);
  164 | }, [theme]);
  165 | (0, _hooks.useUpdate)(function (_) {
> 166 |   editorRef.current.updateOptions(options);
      | ^  167 | }, [options]);
  168 | 
  169 | function createEditor() {

And:

TypeError: Cannot read property 'dispose' of undefined
removeEditor
src/afw_app/admin/node_modules/@monaco-editor/react/lib/Editor/Editor.js:182
  179 | }
  180 | 
  181 | function removeEditor() {
> 182 |   editorRef.current.dispose();
      | ^  183 | }
  184 | 
  185 | return _react["default"].createElement("section", {

I have a few other questions/comments, that I’ll leave in other open issues.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
suren-atoyancommented, Jul 18, 2019

The new version has already been published (1.0.5). @JeremyGrieshop @onatm I’ll kindly ask you to check the new version in your cases. And thank you for the help.

1reaction
suren-atoyancommented, Jul 21, 2019

It’s also done for DiffEditor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[OutSystems Maps] Cannot read properties of undefined ...
TypeError : Cannot read properties of undefined (reading 'dispose'). at Map.dispose (https://mysite.com/Job/scripts/OutSystemsMaps.
Read more >
cannot read properties of undefined (reading 'dispose') google ...
The TypeError: Cannot read properties of undefined (reading 'map') occurs when we call the `map()` method on an `undefined` value, most often when...
Read more >
Uncaught TypeError: Cannot read property 'dispose' of ...
I'm using all the latest versions of create-react-app, react, webpack, amcharts. I've implemented a amchart component with webpack, ...
Read more >
The "Uncaught TypeError: Cannot read property 'dispose' of ...
dxChart - The "Uncaught TypeError: Cannot read property 'dispose' of null" error is thrown after the "W2106 - Labels of 'horizontal' axis ...
Read more >
Cannot read property 'dispose' of null - Soft8Soft
I've got an issue creating a material on runtime. I get the error "Cannot read property 'dispose' of null" in the console.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found