PB-1480: Fix bug with swissearch and crosshair together#1257
PB-1480: Fix bug with swissearch and crosshair together#1257ismailsunni merged 11 commits intodevelopfrom
Conversation
web-mapviewer
|
||||||||||||||||||||||||||||
| Project |
web-mapviewer
|
| Branch Review |
develop
|
| Run status |
|
| Run duration | 01m 38s |
| Commit |
|
| Committer | Ismail Sunni |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
1
|
|
|
0
|
|
|
48
|
| View all changes introduced in this branch ↗︎ | |
3fe2e1e to
1cedf02
Compare
3bf0de9 to
915ea3c
Compare
ltkum
left a comment
There was a problem hiding this comment.
There is something strange going on here :
With your solution, if I go through the legacy parser --> https://sys-map.dev.bgdi.ch/preview/bug-pb-1480-swissearch-crosshair/index.html?swisssearch=46.5057,6.6278&zoom=8&crosshair=marker it works fine, but if I go through the current parser, it goes to the address. I don't think the issue is with the shouldCenter boolean. This boolean had been introduced so that sharing locations would not be overriden by a swisssearch being present. Since then, the swisssearch parameter is no longer kept in the URL, but people can still play around with it.
Also, this only happens when the application is loaded for the first time.
From what I could see, upon starting in map mode, the application will go through setSearchQuery twice. The first time because of the parameter, and it will have its setCenter set to true. The second time, it goes through the else
web-mapviewer/packages/mapviewer/src/store/modules/search.store.js
Lines 165 to 184 in 915ea3c
it can still see the coordinates, but the
shouldCenter parameter is false.
It's not called by the searchParam itself. Perhaps it's the onMounted function of the searchBar which creates a small conflict.
915ea3c to
86cb8a0
Compare
fc6ff9b to
c50f8f5
Compare
851a6a4 to
3e8cb0a
Compare
ltkum
left a comment
There was a problem hiding this comment.
It seems to work, and it's a simplification of the code. Good job. One or two minor modifications could be good, but those are really minor.
packages/mapviewer/tests/cypress/tests-e2e/search/search-results.cy.js
Outdated
Show resolved
Hide resolved
3e8cb0a to
e8ed889
Compare
ltkum
left a comment
There was a problem hiding this comment.
this looks good to me, thanks for your work :)
…o test with swisssearch set
…ery string when sharing location.
e8ed889 to
e574d67
Compare
Test link
Bug description
The issue occurs when the swisssearch value is a valid location and also a valid coordinate. An example from the JIRA issue: http://map.geo.admin.ch/?swisssearch=46.5057,6.6278&zoom=8&crosshair=marker. The query is swisssearch=46.5057,6.6278. It is a valid coordinate, and when we search the location, it returns a valid object:
{ "fuzzy": "true", "results": [ { "attrs": { "detail": "dorfstrasse 46 5057 reitnau 4281 reitnau ch ag", "featureId": "3098536_0", "geom_quadindex": "021131022303023202112", "geom_st_box2d": "BOX(2646205.076 1233096.405,2646205.076 1233096.405)", "label": "Dorfstrasse 46 <b>5057 Reitnau</b>", "lat": 47.247169494628906, "lon": 8.048954963684082, "num": 46, "objectclass": "", "origin": "address", "rank": 7, "x": 1233096.375, "y": 2646205.0, "zoomlevel": 10 }, "id": 974163, "weight": 1546 } ] }Fix
It seems we don't keep the swisssearch in the URL anymore when sharing location, so the center should be set to the swisssearch location.
Result
Legacy URL Parser
With the buggy coordinate
New URL Parser
With the buggy coordinate
Full list of URL variations
I write all possible combinations of the URL here
Test link