4Lus
Problem with Livewire/Alpine.js and Leaflet
Hey there, I am trying to build a custom form field to select a route via a Leaflet map and OSRM. So far, I am only trying to get a working component which lets me select one point on a map.
This works well, however I have the problem that as soon as I click save on my form, the map goes blank. The reason for it is that the map container div is reset (since I am guessing that the form is rerendered) and the code, that initializes the leaflet map, is not run again.
Can you help me figure out, how I can manage my map to rerender, properly?
This is my component: https://pastebin.com/eSbE1RiQ
4 replies