<p dir="auto">As reported in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1623729009" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3971" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/3971/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/3971">#3971</a>, some URLs like <a href="https://www.openstreetmap.org/?mlat=53.32607&mlon=-1.49033" rel="nofollow">https://www.openstreetmap.org/?mlat=53.32607&mlon=-1.49033</a> reset the currently selected layers. In order to restore the previous setting, a user needs to select both map and overlay layers after click on the link.</p>
<p dir="auto">It seems a bit premature to simply override the current layers, in case the link does not include any layer information.</p>
<p dir="auto">Instead, this PR unconditionally extracts the current layers from the _osm_location cookie, so it can be applied consistently across different url parsing alterantives.</p>
<p dir="auto">As before, if the link includes layers in the hash value, that information takes precedence.</p>
<p dir="auto">This change mainly impacts line 144 below:</p>
<pre class="notranslate"><code class="notranslate">mapParams.layers = hash.layers || (loc && loc[3]) || '';
</code></pre>
<p dir="auto">loc[3] will now always contain the selected layers, as long as the cookie is available.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/5529'>https://github.com/openstreetmap/openstreetmap-website/pull/5529</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5529/commits/18fd80ebb77b75622fb60bfa5ec64878a0c7bdc4" class="commit-link">18fd80e</a> Consistent usage of layer information in _osm_location cookie</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5529/files">1 file</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5529/files#diff-a9b88a8a3644f944b9bd54361da588c69fa6a210cf7327194c17895a8ad2b0d6">app/assets/javascripts/osm.js.erb</a>
(7)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5529.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5529.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5529.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5529.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5529">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMUTQDMC56MIFSMXWL2LZ7PVAVCNFSM6AAAAABVTBPK4CVHI2DSMVQWIX3LMV43ASLTON2WKOZSHAYDENBSGM4DCMY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLOUSQBW4LOV3FXMR4D2LZ7PVA5CNFSM6AAAAABVTBPK4CWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHKOCMYAU.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5529</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5529",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5529",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>