diff --git a/src/components/general/GlobalSearchComponent.vue b/src/components/general/GlobalSearchComponent.vue
index 588d56c4..290650e3 100644
--- a/src/components/general/GlobalSearchComponent.vue
+++ b/src/components/general/GlobalSearchComponent.vue
@@ -60,19 +60,14 @@
diff --git a/src/components/wms/LocationsSearchControl.vue b/src/components/wms/LocationsSearchControl.vue
index 3e470a08..ee306738 100644
--- a/src/components/wms/LocationsSearchControl.vue
+++ b/src/components/wms/LocationsSearchControl.vue
@@ -48,6 +48,11 @@ const showLocations = defineModel('showLocations', { default: true })
const state = useGlobalSearchState()
+watch(
+ () => state.selectedItem,
+ (item) => onSelectLocationId(item?.id),
+)
+
const emit = defineEmits(['changeLocationId'])
const selectedLocation = ref(null)
@@ -82,11 +87,10 @@ watch(
() => (selectedLocation.value = getLocationFromId(props.selectedLocationId)),
)
-watch(selectedLocation, onSelectLocation)
-function onSelectLocation(newValue: Location | null) {
- if (newValue === null) {
+function onSelectLocationId(id: string | undefined) {
+ if (id === undefined) {
return
}
- emit('changeLocationId', newValue.locationId)
+ emit('changeLocationId', id)
}
diff --git a/src/stores/globalSearch.ts b/src/stores/globalSearch.ts
index 244f392a..ba0d3caa 100644
--- a/src/stores/globalSearch.ts
+++ b/src/stores/globalSearch.ts
@@ -4,6 +4,7 @@ interface GlobalSearchState {
active: boolean
type: 'locations' | 'parameters' | 'nodes'
items: GlobalSearchItem[]
+ selectedItem: GlobalSearchItem | null
}
interface GlobalSearchItem {
@@ -16,6 +17,7 @@ const useGlobalSearchState = defineStore('globalSearchState', {
active: false,
type: 'locations',
items: [],
+ selectedItem: null,
}),
actions: {},