Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When bringing in a leaflet map via AJAX, none of the features are available to the JS.
This is because the JS is added in an Drupal AJAX insert command on the whole page, so the leaflet behavior runs for this insert, and tries the process the map, but it doesn't find the map, and the only thing it does is clear out the features.
Then, when the map is finally inserted, the behavior runs and tries to create a map, but there are no features.
We can just move the features clearing code to within the code that uses it.
Comment | File | Size | Author |
---|---|---|---|
#3 | leaflet-2858091-3-alternative.patch | 451 bytes | samuel.mortenson |
Comments
Comment #2
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedComment #3
samuel.mortensonI'm seeing similar issues when using Panels IPE on a block that contains a Leaflet Map - the current patch doesn't fix my problem, but completely removing this logic does. @steven-jones - could you try out my patch and see if it also resolves your problem? If not, I'll open a new issue and hide it from the issue summary. Thanks!
Comment #4
beltofteWe have a similar problem with a view block that use some exposed filters. The view is not configured to use AJAX it self, but ajax.js is still called. Maybe because of big_pipe being enabled. The error is:
Looks like @samuel.mortenson' patch from #3 is solving the issue.
Comment #5
GaëlGI had the same problem but on a leaflet attachment display attached to a unformatted list block display. With no AJAX. #3 fixed it.
Comment #6
itamair CreditAttribution: itamair as a volunteer commentedComment #7
itamair CreditAttribution: itamair as a volunteer commented#3 applied to dev
Comment #9
itamair CreditAttribution: itamair as a volunteer commented