-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PB-1480: Fix bug with swissearch and crosshair together #1257
base: develop
Are you sure you want to change the base?
Conversation
web-mapviewer
|
Project |
web-mapviewer
|
Branch Review |
bug-pb-1480-swissearch-crosshair
|
Run status |
|
Run duration | 04m 42s |
Commit |
|
Committer | Ismail Sunni |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
23
|
|
0
|
|
239
|
View all changes introduced in this branch ↗︎ |
3fe2e1e
to
1cedf02
Compare
3bf0de9
to
915ea3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
try { | |
results = await search({ | |
outputProjection: currentProjection, | |
queryString: query, | |
lang: rootState.i18n.lang, | |
layersToSearch: getters.visibleLayers, | |
limit: state.autoSelect ? 1 : null, | |
}) | |
if ( | |
(originUrlParam && results.length === 1) || | |
(originUrlParam && state.autoSelect && results.length >= 1) | |
) { | |
dispatch('selectResultEntry', { | |
dispatcher: `${dispatcher}/setSearchQuery`, | |
entry: getResultForAutoselect(results), | |
}) | |
} | |
} catch (error) { | |
log.error(`Search failed`, error) | |
} |
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
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:
Fix
I set the shouldCenter always true when the string in swisssearch is a valid coordinate, so that it will center to the coordinate (instead searching to a location).
Result
Same query with this PR url: https://sys-map.dev.bgdi.ch/preview/bug-pb-1480-swissearch-crosshair/index.html#/map?swisssearch=46.5057,6.6278&zoom=8&crosshair=marker
Test link