-
Notifications
You must be signed in to change notification settings - Fork 1.3k
MarkerWithLabel: Cannot read property 'removeChild' of null #393
Comments
Thanks a lot, really worked 😄 |
Unfortunately, I've noticed that today without changing any dependencies! |
Something changed in this new google maps js, version 3.32.1a, if you specify an older version like 3.31 (https://maps.googleapis.com/maps/api/js?v=3.31&key=xxx) this problem doesnt happens... |
Agreed that it appears to be related to Google's changes. Spent all day trying to track it down. Specifying an older version with v= in the API URL fixes things, at least for now. |
Just confirming that I'm having the same problem with the latest maps API rev. Your change to line 307 fixed it for me. Thanks! |
I am using react-google-maps and no specific version was mentioned in the API URL. May be it was by default hitting the latest API. |
Fixing the version to 3.31, the error is solved. Another option is to check that it is not null line 309
replace by
|
Thanks for the feedback - I've just pushed the suggested fix. |
Efficient! Thanks |
@stephenmcd , your fix in 045398d was removed in 759d133 |
@awiprayitno , thanks man. Worked for me. |
My fault; this change wasn't integrated when I uploaded all the fixes I had made for the past few years. I will fix later today. |
MarkerWithLabel: Cannot read property 'removeChild' of null
Hi, I'm using nodejs https://www.npmjs.com/package/markerwithlabel ; how to apply this "patch" ? Regards |
@EltonFaust Thank you! That saved my hair. |
This seems like it has returned. Any confirmation? |
This is also causing issues for us, any many folks using react-google-maps. tomchentw/react-google-maps#774 Could you please re-open this? |
The solution with 3.31 does not work anymore. https://developers.google.com/maps/documentation/javascript/versions#choosing-a-version-number |
I'm receiving this error since yesterday. The solution mention above (changing the markerLabel's on remove method) fixes the problem but only locally. I need a fix that does not include changing the node modules. Does any one else started experience this problem since yesterday? |
I am facing the issue Uncaught TypeError: Cannot read property 'parentNode' of null |
Also experiencing this issue, started to notice it today.
|
@jeudywr @haider-ali try this #450 |
I have tried MarkerWithLabel with all the sample code using the latest experimental release of GM and I don't see any errors. Does anyone have a simple example that illustrates the problem? |
@garylittleRLP you can check this app I work for: https://wikirealty.com/search/chicago-il-us/ In the console, you will see the errors. We use markers with labels (through the angular google maps library that uses MarkerWithLabel) to put property prices in the map. It was working fine until today. We were referencing version 3.31 of google maps. ps: we are putting a patch tonight so the example will no longer be available in a few hours. |
same problem here: https://www.ebab.com/Europe/Germany/Berlin |
The issue we were having in NomadGraphix/google-react-maps was that googlemaps/v3-utility-library/tree/master/markerwithlabel started failing with the latest version of google maps. The solution? We are temporarily using this fork of MarkerWithLabel which solves the issue: egdbear/node-MarkerWithLabel What we need is a merge with MarkerWithLabel that fixes this issue. Please see this thread to see why the change is necessary: node-MarkerWithLabel |
Another note, I think the issue may stem from using both the Google Maps Clusterer and MarkerWithLabel in tandem. |
this patch works: https://gist.github.com/kentaromiura/6bb9d0061c92087792f289dfde4989cd |
@NomadGraphix Google's v3-utility-library has made the necessary fix in markerWithLabel in this commit, about 5 month ago. Projects that use jesstelford/node-MarkerWithLabel library are actually using it's version of markerWithLabel, which is an old version and was not updated with the fix and therefore the problem still exist. My problem is a little bit more complex because I do not use directly the jesstelford/node-MarkerWithLabel library. I use react-google-maps library which uses node-MarkerWithLabel internally in it's package.json. I've made a PR to jesstelford/node-MarkerWithLabel , and hopefully he will approve it or do the fix him self. |
For anyone hitting this issue as a result of using third-party forks of |
my PR that fixes the issue on jesstelford/node-MarkerWithLabel was approved. |
I updated the markerWithLabel dependency to "^2.0.2" and still having this issue in the angular-google-maps library. does anyone have a solution? |
@Avivhdr I have made a PR to fix onRemove validation in react google maps by upgrading the version to 2.0.2. Once it gets approved we all can use it like a charm. |
Hi @sakhisheikh, Very good for the initiative! @lironbar If you will delete the |
Hi @Avivhdr thanks for informing.I'm closing the PR. I just saw it is already merged in #892 of react-google-maps. |
In combination with MarkerClusterer, error happened when MarkerClusterer remove Marker
Error was:
Uncaught TypeError: Cannot read property 'removeChild' of null at MarkerLabel_.onRemove (eval at <anonymous> (markerwithlabel_packed.js:1), <anonymous>:1:5570)
Note that this error happened both on the packed and non packed version.
Solution:
I added two ifs in the following (line 307), which fixed this.
MarkerLabel_.prototype.onRemove = function () { var i; if (this.labelDiv_.parentNode) { this.labelDiv_.parentNode.removeChild(this.labelDiv_); } // Remove event listeners: if (this.listeners_) { for (i = 0; i < this.listeners_.length; i++) { google.maps.event.removeListener(this.listeners_[i]); } } };
The text was updated successfully, but these errors were encountered: