question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken in leaflet 1.8.0

See original GitHub issue

Hi !

The plugin does not work anymore with Leaflet 1.8.0 but ok with Lealfet 1.7.1

minmal code : https://codesandbox.io/s/frosty-tamas-yevb21?file=/src/index.js

Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf') at NewClass.addTo (leaflet-src.js:4789:1)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:8
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
unzsnucommented, Apr 20, 2022

I fixed this error setting the position

 const searchControl = new GeoSearchControl({
      position: 'topright', /* <---- add this, options: 'topleft', 'topright', 'bottomleft', 'bottomright' */
      provider: props.provider,
      style: props.controlStyle,
      ...props
    });

Position has not been set yet, so getPosition() returns undefined and then, checking the position, it breaks

1reaction
brbrbrcommented, May 11, 2022

Appears that the default options are not initialized correctly.

I added the lot (extending the fix from unzsnu

  var searchControl = new GeoSearch.GeoSearchControl({
          provider: provider,
          position: 'topleft',
          showMarker: true,
          marker: {
            icon: get_icon('roos'),
            cat: 'roos',
            draggable: true,
          },
          maxMarker: 1,
          autoClose: true,
          autoComplete: true,
          retainZoomLevel: true,
          maxSuggestions: 5,
          keepResult: true,
          resultFormat: function(t) {
            return "" + t.result.label;
          },
          updateMap: !0

        });
Read more comments on GitHub >

github_iconTop Results From Across the Web

leaflet export broken in 1.8.0-beta.0 · Issue #8048 - GitHub
leaflet needs to be changed back to exports since output.name only is used in the UMD wrapper. Inside the function only exports is...
Read more >
Leaflet Marker not found production env - Stack Overflow
This is a known bug in Leaflet, the root issue is that Leaflet's icon image location is been wrongly referenced during bundling.
Read more >
Leaflet 1.8 released in the middle of war
This release is dedicated to Ukrainian fight for freedom and democracy against the Russian invasion (see how you can support Ukraine here).
Read more >
Markers not showing in leaflet map - RStudio Community
Hi I have just started to use leaflet and am experiencing issues showing markers on a basic map. The network tab in my...
Read more >
Leaflet Map < 3.0.0 - Arbitrary Settings Update via CSRF ...
WordPress Security Vulnerability - Leaflet Map < 3.0.0 - Arbitrary Settings Update via CSRF Leading to ... A2: Broken Authentication and Session Management....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found