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.

Cannot read property 'removeChild' of null

See original GitHub issue

I used onMouseDown to delete items data, and I reported this error, unable to locate what the problem was.

      <div
        className='icon-close'
        onMouseDown={this.onDelete.bind(this, value)}>
        <Icon
          type="close-circle"
          className='icon-close' />
      </div>
  onDelete(value: string) {
    console.log(value, 'value')
    let { items } = this.state;
    items = items!.filter((item: string) => item !== value);
    this.setState({ items }, () => {
      this.props.onDelete && this.props.onDelete(items);
    })
  }

image

Deleting will result in an error and a request will be sent. I don't know where the request originated and whether it can be blocked

I need help Thank you

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:23
  • Comments:10

github_iconTop GitHub Comments

12reactions
cpwinncommented, Sep 17, 2019

I just had these same issues. It was caused by my SortableContainer and SortableElement being assigned inside of the render function. Meaning each time I set the state it would re-render and create a new instance of SortableContainer and SortableElement. That would divorce the old SortableElement from the DOM and cause the issues.

So the solution for me was to assign SortableContainer and SortableElement to variables outside of render() and reference those on render. Also, @rectangletangle is correct, updateBeforeSortStart should be used to set state rather that onSortStart.

4reactions
whenmooncommented, Aug 4, 2020

I also have this problem which is very annoying:

	const onSortStart = (): void => {
		console.log('%c sort started!', 'color: green;');
		setIsReorderingColumns((prevState) => !prevState);
	};

Uncaught TypeError: Cannot read property ‘removeChild’ of null

Read more comments on GitHub >

github_iconTop Results From Across the Web

I receive a 'Uncaught TypeError: Cannot read property ...
I have the following vanillaJS and receive the Cannot read property 'removeChild' of null error. The error occurs in the console when I...
Read more >
Cannot read property 'removeChild' of null · Issue #6037 ...
The element whose parentNode no longer exists is an IFRAME and I assume it has been added to the DIV to help measure...
Read more >
Uncaught Type: Cannot Read Property RemoveChild of Null
I have created a form that is working beautifully, but serving up an error in the console each time the user backspaces their...
Read more >
T139822 "Cannot read property 'removeChild' of null" when ...
"Cannot read property 'removeChild' of null" when pressing "Journal" in the Cite window. Closed, ResolvedPublic1 Estimated Story Points.
Read more >
Cannot read property 'removeChild' of null - Google Groups
The next time you encounter this problem, right-click on the page -> Inspect element -> Console tab: here you can trace which plugin...
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