gmap3 icon indicating copy to clipboard operation
gmap3 copied to clipboard

TypeError: class constructors must be invoked with 'new'

Open dexcooper opened this issue 2 years ago • 4 comments

Hello, Recently, I have been experiencing a problem when using GMAP3. On sites where I have been using GMAP3 for a long time I suddenly got the following error: "Uncaught (in promise) TypeError: class constructors must be invoked with 'new'"

This error hits line 155 from the latest version 7.2: return cls.apply(this, args);$

I also see that this problem occurs when running the code on the home page of GMAP3.

Can someone help me solve this problem?

dexcooper avatar Aug 23 '23 14:08 dexcooper

same here on some sites we are using gmap3 ... 🤔

futureweb avatar Aug 24 '23 15:08 futureweb

Now I've had the time to look into this issue ... error comes from latest Google Maps JS API change - 3.54.1. Latest working Version is: 3.53.13

So requesting this Version is my workaround for now: <script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3.53.13&amp;language=de&amp;key=apiKey"></script>

futureweb avatar Aug 25 '23 08:08 futureweb

Hi futureweb, thx for the answer. For now this workaround will help me out!

dexcooper avatar Aug 25 '23 09:08 dexcooper

Replacing the gmElement function with the code below fixes the issue for me:

function gmElement(name) {
  const cls = gm[name];
  const args = slice(arguments, 1);

  return Reflect.construct(cls, args);
}

dalobstah avatar Aug 30 '23 17:08 dalobstah