From: Anton Khorev Date: Sat, 15 Feb 2025 17:03:42 +0000 (+0300) Subject: Merge branch 'pull/5678' X-Git-Tag: live~133 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/3bdbc35bbd8f44bab813adb5c9afe505868e4a09?hp=-c Merge branch 'pull/5678' --- 3bdbc35bbd8f44bab813adb5c9afe505868e4a09 diff --combined app/assets/javascripts/index.js index b6ead9f2d,2cf45e9ad..a5916d3ed --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@@ -38,6 -38,14 +38,14 @@@ $(document).ready(function () $("#sidebar_loader").show().addClass("delayed-fade-in"); + // Prevent caching the XHR response as a full-page URL + // https://github.com/openstreetmap/openstreetmap-website/issues/5663 + if (content_path.indexOf("?") >= 0) { + content_path += "&xhr=1"; + } else { + content_path += "?xhr=1"; + } + $("#sidebar_content") .empty(); @@@ -309,9 -317,8 +317,9 @@@ }; function addObject(type, id, center) { + var hashParams = OSM.parseHash(window.location.hash); map.addObject({ type: type, id: parseInt(id, 10) }, function (bounds) { - if (!window.location.hash && bounds.isValid() && + if (!hashParams.center && bounds.isValid() && (center || !map.getBounds().contains(bounds))) { OSM.router.withoutMoveListener(function () { map.fitBounds(bounds);