TypeError: Cannot read property 'dispose' of undefined
See original GitHub issueHi, 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:
- Created 4 years ago
- Comments:18 (11 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
It’s also done for DiffEditor.