[openstreetmap/openstreetmap-website] Fix incorrect z-order of dashboard map markers (fixes #6639) (PR #6654)
Pablo Brasero
notifications at github.com
Tue Jan 6 17:31:14 UTC 2026
@pablobm commented on this pull request.
A couple of minor comments. Remember to squash the commits as per the contribution guidelines.
> .addTo(map);
+
+ return { marker, lat, lon };
+ })
+ .get();
I like that you use `map` to collect the markers and their lat/lon. However I expect `map` not to have side effects, and here it has one (the `addTo` call).
How about first creating and collecting the markers, as you do here, and then have a separate loop to call `addTo` on each of them?
> @@ -33,14 +33,37 @@ $(function () {
map.touchZoomRotate.disableRotation();
map.keyboard.disableRotation();
- $("[data-user]").each(function () {
- const user = $(this).data("user");
- if (user.lon && user.lat) {
- OSM.MapLibre.getMarker({ icon: "dot", color: user.color })
- .setLngLat([user.lon, user.lat])
- .setPopup(OSM.MapLibre.getPopup(user.description))
+ const markerObjects = $("[data-user]")
+ .map(function () {
+ const { lat, lon, color, description } = $(this).data("user");
+
+ if (!lat || !lon) return null;
I think this is better done as a `filter()` before the `map()`.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6654#pullrequestreview-3631785171
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6654/review/3631785171 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260106/d441c679/attachment-0001.htm>
More information about the rails-dev
mailing list