Leaflet Map Not Visible After State Binding in a Custom Filament v3 Component #15204
Unanswered
adiartawibawa
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Package
Form builder
Package Version
v3.0.0
How can we help you?
Hi everyone,
I'm working on a custom form component for Filament v3 that integrates a Leaflet map with Livewire and Alpine.js. The goal is to allow users to interact with the map (e.g., add markers) and have the data synchronized with Livewire state. The map should also render any existing GeoJSON data from the database.
However, I'm facing an issue where the map becomes invisible after successfully binding data to the Livewire state. The browser console throws the following error:
What I've Implemented So Far:
I created a custom component called
MapPicker
with Livewire state synchronization. It is used in the form like this:GeoJSON data, like the example below, is used to represent the map's state:
Here's the Blade code rendering the map:
The
initializeMap()
function in my Alpine.js script:The Problem:
Uncaught TypeError: t.parentNode is null
.Questions:
Uncaught TypeError: t.parentNode is null
in Leaflet when working with Livewire and Alpine.js?afterStateHydrated
andafterStateUpdated
correct for this use case, or is there a better way to bind and rehydrate the state?Any guidance or suggestions would be greatly appreciated! Thank you in advance. 😊
Beta Was this translation helpful? Give feedback.
All reactions