@pablobm commented on this pull request.

Something I'm seeing is that the `fetch` is issued once for every minimap. On 
one hand it's not a big issue because the server side knows to respond with a 
304 status, but it's still additional, unnecessary requests that we could avoid 
by caching on our side.

> @@ -6,6 +6,17 @@ maplibregl.Map.prototype._getUIString = function (key) {
   return OSM.i18n.t(`javascripts.map.${snakeCaseKey}`);
 };
 
+OSM.MapLibre.showWebGLError = function (container) {
+  const containerElement =
+    typeof container === "string" ? document.getElementById(container) : 
container;
+
+  if (containerElement) {
+    fetch("/panes/webgl_error")

Re: the conversation about Turbo. I'm not really super knowledgeable on the 
topic. However I'm not sure this is quite the use case for it. Normally I've 
seen it in action responding to DOM events automatically, as opposed to 
programmatically like this `fetch` here.

Having said that, I can make this fetch work with `Turbo.fetch` as a drop-in 
replacement:

```suggestion
    Turbo.fetch("/panes/webgl_error")
```

All this appears to do is adding a header `X-Turbo-Request-Id` to the request. 
(See 
[code](https://github.com/hotwired/turbo/blob/4481af6b6d7483363a44ee9f4af2e0f879c83b3c/src/http/fetch.js#L6)).
 No idea what this is for of whether we should be doing it in the first place.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6782#pullrequestreview-3876141995
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/6782/review/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to