Hi Alexandru
I have the sam issue. I’m loding the mapbox with alpine.
Made a componant
<div
wire:ignore
x-data
x-init="
mapboxgl.accessToken = 'XXX';
var map = new mapboxgl.Map({
container: 'mapbox',
style: 'mapbox://styles/mapbox/streets-v11',
center: [-18.95, 65.00],
zoom: 5 // starting zoom
});
map.on('load', (event) => {
map.resize();
});
var geocoder = new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
countries: 'is',
mapboxgl: mapboxgl,
marker: true,
placeholder: 'Austurvöllur',
});
map.addControl(geocoder);
geocoder.on('result', function(e) {
const marker = new mapboxgl.Marker({ draggable: true, color: 'pink' })
.setLngLat(e.result.center)
.addTo(map);
mapMarkers.push(marker);
});
"
class="w-full h-96"
>
<div class="w-full h-96" id="mapbox" ></div>
</div>
And add it to my livewire form like
<x-input.mapbox/>
When I update any livewire items in the form, the mapbox reload.
isn’t wire: ignore suppose to handle that.