Problem/Motivation
Wow, it looks amazing, thanks for building this @itamair! It's a killer feature to have available for Leaflet, since (as you know) hand configuring it can require a lot of steps, as well as setting break points for the value intervals, setting colours, etc.
Having all this done automatically with this module almost feels like magic :)
I did run into a small bug, where the legend is not rendered in a standard Page View. It is however shown in the Views edit page ...
UPDATE #1: This only happens, when logged in with user who has a role, like the "Administrator" or "Content editor" role, on a Views page (not edit). For Anonymous and a standard registered users, the legend is shown.
Everything in the View is using default settings, like a location field with everything in standard setting, and an integer field, for intervals.
UPDATE #2: The problem seem to happen when the Big Pipe module is installed, if you disable it, the Leaflet Choropleth Legend is show for al users.
Steps to reproduce
Proposed resolution
Check if it can be made work with Big Pipe installed.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | Screenshot 2025-07-20 at 22.22.03.jpg | 214.82 KB | itamair |
| #7 | Screenshot 2025-07-20 at 22.22.52.jpg | 207.57 KB | itamair |
Comments
Comment #2
ressaComment #3
ressaComment #4
ressaComment #5
ressaComment #6
itamair commentedThanks @ressa for trying out the new Leaflet Choropleth module, and glad that your first feedback is so positive.
Please keep testing and reviewing it, and let the community know what could eventually be improved.
On this specific issue that you report as a (small) bug ... well I cannot reproduce it in both the Drupal playgrounds that I am developing and testing this module on.
As you can see from the attached screenshots, the Legend correctly shows up to my itamair administrator user, in the Leaflet Choropleth View.
And it looks weird and really un-expected what happens to you, because the leaflet_choropleth.js functional logics doesn't depend on any user permission, as you can see here:
https://git.drupalcode.org/project/leaflet_choropleth/-/blob/1.0.x/js/le...
It probably depends on some specific js settings or break that happens on your js workflow, on the FE with administrator user ...
You should inspect how your js workflow proceeds (and if it breaks) in your Browser Js inspector, with proper breakpoints ...
if that self.addChoroplethLegend method is correctly invoked, that (ste by step) you should also check if it correctly goes through here:
https://git.drupalcode.org/project/leaflet_choropleth/-/blob/1.0.x/js/le...
Of course, be sure you are testing lates module release (1.0.2) and please clear both your drupal and browser cache, to make sure ...
Comment #7
itamair commentedComment #8
ressaThanks for a fast reply @itamair, the new module is nothing less than spectacular, since users can now add a Choropleth so easily.
About the bug, thanks for trying to replicate it. It is really strange ... It happens with 1.0.2 and the latest Leaflet Choropleth dev-release in a fresh Drupal 10 installation in DDEV, with no customizations, so no specialized workflows, or anything. I also tried with Olivero and Claro themes as well, and it also happens there.
I found out some more details: It happens for any user with a role. So I added and removed the Content Editor role with the same result. I also looked at the source and noticed that a lot of JavaScript files were only loaded for a user with a role, and scanning the list, one stood out, since I have previously had strange JavaScript problems with that:
Big Pipe.
After uninstalling Big Pipe module, the Choropleth Legend is show in all scenarios.
Maybe you have disabled it, and that's why you don't see this problem?
I have previously used a non-standard Drupal sandbox myself for testing patches (for Admin Toolbar) with customizations, other modules, etc. and realized the value of using a fresh dedicated Drupal instance.
Comment #9
ressaComment #10
itamair commentedOk super nice catch @ressa.
I can reproduce what you describe.
It looks that, with Big Pipe installed, the additional leaflet_choropleth js library is being requested too late, and it is not hooking on the 'leafletMapInit' event appropriately, and this looks happening only when the user is logged in, etc.
I am going to better inspect all this, and implement a more robust (and forced) injection of that.
At the moment a quick workaround on this would be to always check/flag Lazy Loading of the Leaflet Map (that is the option right before the new Choropleth Map Settings section ...
Comment #12
itamair commentedthanks again @reassa ... your inspections pointed me to the right direction.
It looks this was somehow caused and related to this open issue: https://www.drupal.org/project/drupal/issues/3272693
that may be is not even a bug but just the proper ways Drupal behaviours work.
And luckily the fix was easy ...
This should now be solved by the latest 1.0.3 release, just deployed.
So closing this as Fixed.
Appreciate if you could confirm on your side, or reopen this if not ...
Comment #13
itamair commentedComment #14
ressaIt works now, thanks @itamair!
My intention with adding Big Pipe related issues was to connect them, in case others run into something similar, look in the search engines and find this issue, or one of the other ones -- in which case they can visit this, or one of the other issues, and use as inspiration for a solution, depending on what their problem is.
Comment #15
ressaBy the way, I would love to have a Leaflet Choropleth credit under my profile as a badge of honour, so maybe that's possible?
As a side note, it has gotten easier to grant credit, and it can be done at any time now, even after an issue is permanently closed (perhaps after #3427961: Grant credit for all closed issues, not just fixed issues?).
So as a maintainer, you can simply check the box and save, and credit is given.
I did a test run together with @grzegorzbartman from Droptica.com in #3521696-13: Embed fonts to comply with EU GDPR, and it worked well, so I updated the Credit documentation page https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett....
Comment #16
itamair commentedArggghhh ... totally my fault @ressa.
I simply forgot to do that, and definitely you deserve it also this time.
Let me try this new easier way and simply checking you along this additional message.
Comment #17
ressaNo problem, thanks @itamair! The credit got registered ("Leaflet Choropleth, 1 issue" is now in my profile) so it's great that it's easier to grant, even after an issue has been closed.
I created an issue about Big Pipe #3537357: [Meta] Big Pipe related issues, causing seemingly random failures. Have a great day.