Problem/Motivation
I have an inherited Drupal site which uses leaflet views and widgets. The current core version is 8.9.19 - in preperation to upgrading to Drupal 9 I need to update Leaflet which is currently using 8.x-1.0-beta16.
After updating Leaflet to version 2.1.16 my pages with Leaflet widgets work fine, however my views using Leaflet maps never load. I believe this is a problem with the map icons when using 'Icon Image Url/Path'. When using the same 'Icon Image Url/Path' as on previous version the page does not load and the Drupal site running on my local staging environment hangs.
If I change the map icons from 'Icon Image Url/Path' to 'Circle Marker' I am able to load the page and the map seems to render as expected.
I've checked that the 'Icon Url' and 'Icon Shadow Url' are valid paths and that the files can be loaded in the browser. I've also tested using relative and absolute paths.
When the view eventually loads after about an hour (normal functionality is sub 30 seconds), there is one javascript error in the F12 console, however this was present pre-upgrading Leaflet so I don't think it is the cause. The fact that the local server hangs also makes me think that there is a serverside issue happening rather than a clientside one:
There aren't any errors showing in watchdog either, the only thing I can see is the following notice:
There is one small (consisting of just a .info.yml and .module files) custom module (vs_leaflet) on the site which seems to set some leaflet settings in case that is of any relevence, however I have tried disabling this module to see if that helped but it did not:
Steps to reproduce
Core version: 8.9.19
Leaflet version: 8.x-1.0-beta16 => 2.1.16
Leaflet_markercluster version: 8.9.19
Leaflet_views version: 8.x-1.0-beta16
Php version : 7.4.15
These are the steps I followed to upgrade:
rm -r libraries/leaflet_markercluster
drush pmu leaflet_markercluster
drush pmu leaflet_widget
composer remove drupal/leaflet_markercluster
composer remove drupal/leaflet_widget
composer remove leaflet/leaflet
composer remove leaflet/leaflet_markercluster
drush cr
composer require drupal/leaflet:^2.0.0
drush updb
drush cr
drush en leaflet_markercluster -y
drush cr
Also enabled markercluster submodule in the view:
Output of pm:list after the upgrade:
Proposed resolution
N/A
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
I have tried to include all steps and anything else that may help explain the process but if there is anything else I can provide to help please ask, thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screenshot 2022-03-01 at 21.50.44.png | 382.96 KB | itamair |
Comments
Comment #2
cianevans commentedUnsure if anyone has had a chance to be able to look at this issue yet or not. If so is there any other information I can provide that may be of use in figuring out whats going wrong after the upgrade process?
Comment #3
itamair commentedThanks for reporting your issues @cianevans ... but sorry I cannot reproduce your issues, and this is not a bug at all.
On this side the Leaflet module 2.1.20 release (upgrade to it eventually ...) works as designed.
As confirmation of that just consider that this Leaflet demo page: http://www.geodemocracy.com/geofield_d8/web/geoplaces-map-leaflet
is indeed working with Map Icon as "Icon Image Url/Path" with a token (@see the screenshot),
and double checking also other settings all works fine on my side ...
Your should have some issues with your personal setup, or may be some JS conflict with some custom or other contrib module ... all on your side.
Comment #4
cianevans commentedHi Itamir
I have had another chance to look at this problem today and after seeing your screenshot decided to try without shadows (leaving field 'Icon Shadow URL' empty) and this did indeed work for me!
I also noticed that by default 'Shadow Size' field is empty but does state the following "Size of the shadow image in pixels (if empty the natural shadow image size will be used). ". So I then tried adding the shadow image path back, and also entering a size for the shadow, and the map now works as it used to.
So it seems to me as if there may be a bug where the 'Shadow Size' does not default to the image size when left empty, and this is the cause of the issue, at least on my end. Is this something that you could try on your end to confirm?
Thanks
Comment #5
kle commentedI have encountered the same problem. A map with 800 elements "clogs" the server.
Cause: in LeafletService::setFeatureIconSizesIfEmptyOrInvalid() you call @get_headers($fileUrl) and $this->fileExists() for each Map-Element.
On our Heavy-Traffic site this caused the view to take 15s for 100 Elements and ends with a white screen on 800 elements (on local environment it runs fine).
I use STATIC, to avoid calling often the system-calls which solved the problem at our site:
Thanks anyway for the great module !!