[openstreetmap/openstreetmap-website] Cancel pending Export sidebar loads on unload (PR #7268)

daishu0000 notifications at github.com
Fri Aug 7 00:05:07 UTC 2026


@daishu0000 commented on this pull request.



> @@ -146,6 +149,15 @@ OSM.Router = function (map, rts) {
     window.history.replaceState(OSM.parseHash(url), document.title, url);
   };
 
+  router.withAbortSignal = function (callback) {
+    return callback(abortController.signal)
+      .catch(error => {
+        // Do not resolve aborted requests and run the exiting controller's callbacks.
+        if (error.name === "AbortError") return new Promise(() => {});

if we just `return Promise.resolve();` , the old process can't be aborted and the bugs will still remain. Thus we use `new Promise(() => {});` to stop the old process when we open a new sidebar.

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

Message ID: <openstreetmap/openstreetmap-website/pull/7268/review/4878852445 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260806/bdd6bbc0/attachment-0001.htm>


More information about the rails-dev mailing list