Skip to content

fix bug with inferno - #291

Closed
mariusandra wants to merge 0 commit into
GoogleMapReact:masterfrom
mariusandra:master
Closed

mariusandra wants to merge 0 commit into
GoogleMapReact:masterfrom
mariusandra:master

Conversation

@mariusandra

Copy link
Copy Markdown
Contributor

Hey, I'm trying to migrate from React to InfernoJS. Everything works great, except somehow in componentWillUnmount the DOM is already gone (mapDom === null) and this line throws an exception.

@mariusandra

Copy link
Copy Markdown
Contributor Author

I think there was a typo there as well. addResizeListener should be removeResizeListener

Comment thread src/google_map.js
const mapDom = ReactDOM.findDOMNode(this.refs.google_map_dom);
window.removeEventListener('resize', this._onWindowResize);
window.removeEventListener('keydown', this._onKeyDownCapture);
mapDom.removeEventListener('mousedown', this._onMapMouseDownNative, true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why findDOMNode returns null on Inferno?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Seems like a mistake with inferno. I reported it here: infernojs/inferno#590 . Not sure if/when it will be fixed.

Comment thread src/google_map.js
mapDom.removeEventListener('mousedown', this._onMapMouseDownNative, true);
window.removeEventListener('mouseup', this._onChildMouseUp, false);
window.removeEventListener('touchmove', this._onTouchMove);
detectElementResize.addResizeListener(mapDom, that._mapDomResizeCallback);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes looks like mistake

@istarkov

Copy link
Copy Markdown
Member

Ill merge today evening or tomorrow morning, its fun to see that libraries work with inferno preact etc, wanna to play with too

Comment thread src/google_map.js Outdated
window.removeEventListener('mouseup', this._onChildMouseUp, false);
window.removeEventListener('touchmove', this._onTouchMove);
detectElementResize.addResizeListener(mapDom, that._mapDomResizeCallback);
if (mapDom) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could u add a comment that this check is for inferno support

@lock

lock Bot commented Dec 1, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Dec 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants