- Issue created by @ressa
- 🇮🇹Italy itamair
Thanks @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 ...
- 🇩🇰Denmark ressa Copenhagen
Thanks 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.
- 🇮🇹Italy itamair
Ok 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 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 ...
- 🇮🇹Italy itamair
thanks 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 ✨ Simplify supporting AJAX/BigPipe in Drupal.behaviors: improve DX in case the selector to search is not in the given tree, but the root Active
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 ...
- 🇩🇰Denmark ressa Copenhagen
It 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.
- 🇩🇰Denmark ressa Copenhagen
By 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 ✨ Grant credit for all closed issues, not just fixed issues Active ?).
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... → .
- 🇮🇹Italy itamair
Arggghhh ... 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. - 🇩🇰Denmark ressa Copenhagen
No 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 🌱 [Meta] Big Pipe related issues, causing seemingly random failures Active . Have a great day.