[openstreetmap/openstreetmap-website] Clean up promise related code (PR #7265)

Marwin Hochfelsner notifications at github.com
Thu Jul 23 17:10:23 UTC 2026


@hlfan commented on this pull request.



>          updateSecondaryNav();
       });
     return routingInProgress;
   }
 
-  $(window).on("popstate", function (e) {
-    if (!e.originalEvent.state) return; // Is it a real popstate event or just a hash change?
-    const path = location.pathname + location.search,
-          route = routes.recognize(path);
+  addEventListener("popstate", function ({ state }) {

Both! The event jQuery dispatches is a wrapper around the original event, which we can get with `e.originalEvent`. If we don't need any of the jQuery-specific stuff, then we can get the state easier.

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

Message ID: <openstreetmap/openstreetmap-website/pull/7265/review/4766454899 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260723/f19c5e01/attachment.htm>


More information about the rails-dev mailing list