X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/8258a52336c84b5bce8352334f5e356543df1b57..2ba00544d30017ad30570011b1a2bcc6a8da73a7:/src/components/SearchSectionReverse.svelte?ds=sidebyside

diff --git a/src/components/SearchSectionReverse.svelte b/src/components/SearchSectionReverse.svelte
index 70174b6..1808b30 100644
--- a/src/components/SearchSectionReverse.svelte
+++ b/src/components/SearchSectionReverse.svelte
@@ -1,4 +1,5 @@
 <script>
+  import { onDestroy } from 'svelte';
   import UrlSubmitForm from '../components/UrlSubmitForm.svelte';
 
   import { zoomLevels } from '../lib/helpers.js';
@@ -19,7 +20,7 @@
     refresh_page('reverse', params);
   }
 
-  map_store.subscribe(map => {
+  const unsubscribe = map_store.subscribe(map => {
     if (map) {
       map.on('click', (e) => {
         let coords = e.latlng.wrap();
@@ -40,6 +41,8 @@
   function set_api_param(e) {
     document.querySelector('input[name=' + e.target.dataset.apiParam + ']').value = e.target.value;
   }
+
+  onDestroy(unsubscribe);
 </script>
 
 <UrlSubmitForm page="reverse">
