Skip to content

Conversation

herzog31
Copy link
Member

Description

This PR fixes a potential exception with the ReactDOM.unmountComponentAtNode method call when the result of _rootShadows.get(this) is undefined.

I could consistently reproduce the issue in the context of the AEM editor, but couldn't find a minimal example to demonstrate the issue.

react-dom.development.js:27628 Uncaught Error: unmountComponentAtNode(...): Target container is not a DOM element.
    at Object.unmountComponentAtNode (react-dom.development.js:27628)

How Has This Been Tested?

Manual testing.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@alexmirea
Copy link

@herzog31 Thanks for spotting this! Yes if the node is undefined, the call to unmount from react will throw an error. https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMount-test.js#L30
But I would still check if there isn't some code that destroys the element somehow. The creation phase shouldn't leave the reference unassigned in the map. If you can reproduce it somehow to test it, I think that would be good.

@alexmirea alexmirea merged commit 7956867 into adobe:master Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants