[openstreetmap/openstreetmap-website] "layeradd layerremove" event handlers dramatically slow down Map data layer rendering (Issue #5466)

Roman Deev notifications at github.com
Sun Jan 5 08:44:26 UTC 2025


What if we add a layer type check to the handler for which the handler was triggered? Something like:
```js 
map.on("moveend layeradd layerremove", function (e) { 
   if (!L.TileLayer.prototype.isPrototypeOf(e?.layer)){
	  return
   }
   updateLinks( 
     map.getCenter().wrap(), 
     map.getZoom(), 
     map.getLayersCode(), 
     map._object); 
  
   Cookies.set("_osm_location", OSM.locationCookie(map), { secure: true, expires: expiry, path: "/", samesite: "lax" }); 
 }); 
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5466#issuecomment-2571549034
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/5466/2571549034 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250105/f8e72c32/attachment.htm>


More information about the rails-dev mailing list