React-modal: React v16-beta upgrade - componentWillUnmount error

Created on 10 Aug 2017  路  6Comments  路  Source: reactjs/react-modal

Summary:

The Modal component is throwing an error in componentWillUnmount after upgrading React to v16-beta.

Steps to reproduce:

  1. Upgrade React to @next
  2. Use the Modal component as before.
  3. Remove the containing component from the DOM and the error will occur

image

Additional notes:

After some research, it seems this is directly related to the usage of renderSubtreeIntoContainer method to set this.portal in Modal. This is described in depth in https://github.com/facebook/react/issues/10309. Since portal is never set correctly, assuming its existence in componentWillUnmount causes the error.

Details

  • Mac OSX
  • Chrome v59.0.3071.115
bug

All 6 comments

Hi @jakepeyser #474 is available. A new version will be available today.

Brilliant. Thanks @diasbruno

Released v2.2.3.

In my case, ReactModalPortal DOM elements are leaked due to this. When this.portal is undefined, things do not get cleaned up. This can be reproduced in my case with React 16 only - it works fine with React 15.x. Can you please check your DOM and see if things get cleaned up?

@uwolfer [email protected] is available now. Let me know if this still happens.

To install, use npm install react-modal@next.

@diasbruno: Thank you, this fixes my issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tairy-potter picture tairy-potter  路  3Comments

kinucris picture kinucris  路  3Comments

jrock17 picture jrock17  路  4Comments

claydiffrient picture claydiffrient  路  4Comments

phaedryx picture phaedryx  路  4Comments