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.

[Bug] TypeError: Cannot read property 'deactivate' of null

See original GitHub issue

I am trying to use editor.js with react hooks and every time I am trying to destroy the editor I get the following error: TypeError: Cannot read property 'deactivate' of null

From what I can see, when you call the destroy method on the editor instance the destroy methods of BlockSettings and Toolbox are being called twice.

  1. src/codex.ts: the first call to destroy happens in here
  2. src/components/modules/toolbar/index.ts: the second call to destroy happens here

Both destroy methods of BlockSettings and Toolbox are setting this.flipper = null after a calling this.flipper.deactivate() and thus the error message: TypeError: Cannot read property 'deactivate' of null

Steps to reproduce: Demo App: https://react-editor.vercel.app/ Demo source code: https://github.com/riezler-co/editorjs-demo The modified editorjs code: https://github.com/riezler-co/editor.js

Expected behavior: I can destroy the editor without throwing an exception

Screenshots: https://drive.google.com/file/d/1DMvTvP2MKnCPiOSW92tMKlGqTw1TBRHU/view?usp=sharing

Device, Browser, OS: Version 86.0.4240.111 (Official Build) (64-bit)

Editor.js version: 2.19.0

Plugins you use with their versions: none

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
aominicommented, Nov 10, 2020

Not sure if this is ideal but for the time being I tried this in my react component

if (instance) {
      document.querySelector(`#${holder} .codex-editor`).remove();
    }
2reactions
sam26880commented, Nov 5, 2020

Is there any update on this issue? I’m seeing this as well.

I ran into this issue when using the readOnly flag set to true. When I remove the flag, it works fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to deal or remove "Cannot read property 'destroy' of null"
"Cannot read property 'destroy' of null" - This error has occurred because the underlying js implementation gets failed to initialize the global sectionIndex...
Read more >
Cannot read properties of null (reading '_leaflet_disable_click ...
Unhandled Runtime Error TypeError: Cannot read properties of null (reading '_leaflet_disable_click') Call Stack NewClass.
Read more >
Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >
Cannot read property 'value' of null" error message while ...
Getting this below error message while trying to submit the Catalog Task: Error MessageonSubmit script error: TypeError: Cannot read property 'value' of ...
Read more >
uncaught typeerror: cannot read properties of null ... - You.com
You can fix this by checking the result of document.getElementById(id) before proceeding. function changeDrop ...
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