Skip to content

NPM package outdated #970

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

Open
ebhoren opened this issue Mar 6, 2025 · 3 comments
Open

NPM package outdated #970

ebhoren opened this issue Mar 6, 2025 · 3 comments
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ebhoren
Copy link

ebhoren commented Mar 6, 2025

I think the official NPM package of this repository is not up to date.
When i compare code from the main branch to code pulled from NPM in my project node_modules/, MarkerClusterer.renderClusters method code is slightly different. I'm pulling 2.5.3 from NPM.

I've notice this while navigating the source code trying to figure out why this warning was showing up in my developer console.
<gmp-advanced-marker>: Please use addEventListener('gmp-click', ...) instead of addEventListener('click', ...).

When looking at the source code from Github in https://github.com/googlemaps/js-markerclusterer/blob/main/src/markerclusterer.ts#L264, you can see that it seem to be handled properly. Unfortunately, when i looked at the same code pulled from NPM (@googlemaps/markerclusterer/dist/index.esm.js#L942), click handling isn't done the same way.

I think the problem came from distribution files not being recompiled before being publish to NPM.
Is that possible to take a look at this issue?

Thanks

@ebhoren ebhoren added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 6, 2025
@niborium
Copy link

Yes, please fix this as we get same warning after updating to latest google maps api ver (3.60.5) and now i need to suppress it like this:

  const originalConsoleWarn = console.warn;

  console.warn = (...args: any[]) => {
    const warningMessage = args.join(' ');

    // Suppress specific Google Maps warnings
    if (
      warningMessage.includes(
        "Please use addEventListener('gmp-click', ...) instead of addEventListener('click', ...).",
      )
    ) {
      return; // Ignore this warning
    }

    // Otherwise, log other warnings as usual
    originalConsoleWarn(...args);
  };

@seb9465
Copy link

seb9465 commented Apr 8, 2025

I am getting the same warning here. It would be great to have an update on that one!

@mrienstra
Copy link

mrienstra commented May 4, 2025

This package hasn't been released for a bit, the last release on npm is 2.5.3, see release notes. Jan 29, 2024, 42 commits to main since then.

There's also a 2.5.4 release but it doesn't contain any code changes. Jul 30, 2024, 34 commits to main since then.

Looks like there's an open release PR, @usefulthink any chance you can take a look? #936

In the meantime, you can install from this repo instead of npm, see https://docs.npmjs.com/cli/v11/configuring-npm/package-json#git-urls-as-dependencies -- e.g. to point to #ec322bf (the current most recent commit on main):

"@googlemaps/markerclusterer": "googlemaps/js-markerclusterer#ec322bf"

https://github.com/googlemaps/js-markerclusterer/blob/main/src/markerclusterer.ts#L264 shows the latest code from the main branch, to see code for the 2.5.3 release: https://github.com/googlemaps/js-markerclusterer/blob/v2.5.3/src/markerclusterer.ts#L262

Tip: linking to main can be a little confusing to future readers, as they have to match up dates to figure out which commit you were looking at. You can instead (or in addition) link to a specific commit (like a permalink), e.g. https://github.com/googlemaps/js-markerclusterer/blob/ec322bf/src/markerclusterer.ts (current latest commit on main branch) or https://github.com/googlemaps/js-markerclusterer/blob/e43e3e7/src/markerclusterer.ts (current latest commit which modified that file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants