Skip to content

Identifier 'urldefaultMapId' has already been declared #57

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

Closed
bgsPortal opened this issue Feb 9, 2025 · 1 comment
Closed

Identifier 'urldefaultMapId' has already been declared #57

bgsPortal opened this issue Feb 9, 2025 · 1 comment

Comments

@bgsPortal
Copy link

Your code snippet

// Leaflet
// A basic map is as easy as using the x blade component.

<x-maps-leaflet></x-maps-leaflet>

// Set the centerpoint of the map:
<x-maps-leaflet :centerPoint="['lat' => 52.16, 'long' => 5]"></x-maps-leaflet>

// Set a zoomlevel:
<x-maps-leaflet :zoomLevel="6"></x-maps-leaflet>

// Set markers on the map:
<x-maps-leaflet :markers="[['lat' => 52.16444513293423, 'long' => 5.985622388024091]]"></x-maps-leaflet>

results in 3 Uncaught SyntaxError: Identifier 'urldefaultMapId' has already been declared errors in the console. Not sure what the expected result is on the map since i dont see a marker. This happens with a fresh Laravel 11 project and only this plugin being installed additionally.

So each additional x-maps-leaflet creates an error output.

@LarsWiegers
Copy link
Owner

LarsWiegers commented May 30, 2025

Adding an id to each unique map solves this:

    <x-maps-leaflet :zoomLevel="6" id="map2"></x-maps-leaflet>

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