@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/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to