Problem/Motivation
The system provides an issue when displaying a View with nodes (with Geofield values) on a Leaflet map.
Steps to reproduce
- Install the module with composer and activate it. Geofield and Leaflet were previously installed.
- Create a view with node content with Geofield data. Display based on Leaflet.
- Set the filter with Polygon Draw according to the documentation. The issue comes out from the console log even in the preview.
Displayed error:
TypeError: Cannot read properties of undefined (reading 'lMap') at views_polygon_search_freedraw.js?v=1:174:38
Coming from const map = $('.view-content > div[id*=leaflet-map]', $view);, it seems that const mapData = map.data("leaflet"); returns an undefined value.
Proposed solution
Change the line const map = $('.view-content > div[id*=leaflet-map]', $view);
Into const map = $('div[id*=leaflet-map]');
It seems to be working but should be reviewed by the community.
Comments
Comment #2
darklight90 commented