Problem/Motivation

The system provides an issue when displaying a View with nodes (with Geofield values) on a Leaflet map.

Steps to reproduce

  1. Install the module with composer and activate it. Geofield and Leaflet were previously installed.
  2. Create a view with node content with Geofield data. Display based on Leaflet.
  3. 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

darklight90 created an issue. See original summary.

darklight90’s picture

Issue summary: View changes
Status: Active » Needs review