Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverlayViewHelper.js:44 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node' #461

Closed
davidbarker opened this issue Apr 7, 2017 · 2 comments

Comments

@davidbarker
Copy link

davidbarker commented Apr 7, 2017

I'm using OverlayViews instead of markers in order to make them completely custom. Everything was working as expected until I started using setState with a callback.

For example, I'm currently doing the following:

this.setState(newState.toJS(), () => {
    this.fitBoundsToResults();
});

which leads to the error:

OverlayViewHelper.js:44 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
at Object.mountContainerElementToPane (OverlayViewHelper.js:44)
at Object.draw (OverlayView.js:129)
at _baseDelay.js:18

That appears to be referencing:

function mountContainerElementToPane(mapPanes, containerElement, props) {
    var mapPaneName = props.mapPaneName;

    (0, _invariant2.default)(!!mapPaneName, "OverlayView requires either props.mapPaneName or props.defaultMapPaneName but got %s", mapPaneName);
    // https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapPanes
    mapPanes[mapPaneName].appendChild(containerElement);
}

This only happens the first time I update the results. I'm using Google Places so I get 20 results initially, which creates 20 overlay views, and 20 of the above errors. However, if I then paginate the results and get 20 more results, 20 new overlay views are added to the map but I don't get errors.

If I comment-out the callback, no errors appear (but then the bounds no longer get updated, of course).

Any idea why this might be happening? Or a suggestion on a better way to achieve the bounds change?

@davidbarker davidbarker changed the title Uncaught TypeError: Cannot read property 'overlayMouseTarget' of undefined when using OverlayView OverlayViewHelper.js:44 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. when using OverlayView Apr 7, 2017
@davidbarker davidbarker changed the title OverlayViewHelper.js:44 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. when using OverlayView OverlayViewHelper.js:44 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node' Apr 7, 2017
@davidbarker
Copy link
Author

It's not ideal, but I can avoid the errors if I do the following:

this.setState(newState.toJS(), () => {
    setTimeout(this.fitBoundsToResults, 10);
});

@tomchentw
Copy link
Owner

Please refer to Getting Help section in the README (or #469).

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

No branches or pull requests

2 participants