[openstreetmap/openstreetmap-website] Fix home location error after page refresh (PR #7351)
Mohd Farhan Akhtar
notifications at github.com
Mon Aug 31 12:28:00 UTC 2026
### Description
Fixes #7187.
I noticed that when using "Go to Home Location", everything works fine initially, but refreshing the page can move the map back to the home location instead of keeping the position from the URL.
The issue is that clicking "Go to Home Location" now navigates to `/account/home`, so when the page is refreshed, the map is initialized again. The existing code would always move the map to the home location during initialization, even when the URL already contained a map position.
I changed the home location code so that these two cases are handled separately. When the user actually clicks "Go to Home Location", the map still moves to their home location as before. When the page is loaded or refreshed with a map position in the URL, that position is respected instead of being overwritten.
I also added a regression test covering the case where `/account/home` is refreshed with a map position in the URL.
### How has this been tested?
I checked the JavaScript with `node --check` and it passed.
I also tested the home location flow manually, including refreshing the page with a map position in the URL.
I wasn't able to run the Rails test suite or RuboCop in my current environment because the project requires Ruby 3.3.0 or newer, while my current environment has Ruby 3.2.3.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/7351
-- Commit Summary --
* Fix home location reload refresh
-- File Changes --
M app/assets/javascripts/index_modules/home.js (26)
M test/system/account_home_test.rb (10)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/7351.patch
https://github.com/openstreetmap/openstreetmap-website/pull/7351.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7351
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/7351 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260831/3e3da134/attachment.htm>
More information about the rails-dev
mailing list