X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/2648d9d1b739d7d4c402b639fa31dcfa9ae5890d..c0d1fb859fee050373df1fa77d03cb2c1a8cde91:/src/components/LastUpdated.svelte

diff --git a/src/components/LastUpdated.svelte b/src/components/LastUpdated.svelte
index 3f914ce..44738f2 100644
--- a/src/components/LastUpdated.svelte
+++ b/src/components/LastUpdated.svelte
@@ -1,15 +1,23 @@
 <script>
+  import PageLink from './PageLink.svelte';
   import * as timeago from 'timeago.js';
   import { last_api_request_url_store } from '../lib/stores.js';
   import { fetch_from_api } from '../lib/api_utils.js';
 
   let last_updated_date;
   let last_api_request_url;
+  let fetch_running = false; // prevent multiple parallel fetch runs
 
   last_api_request_url_store.subscribe(url => {
     last_api_request_url = url;
+
+    if (fetch_running || last_updated_date) return;
+
+    fetch_running = true;
+
     fetch_from_api('status', { format: 'json' }, function (data) {
       last_updated_date = data.data_updated;
+      fetch_running = false;
     });
   });
 </script>
@@ -53,6 +61,7 @@
         Data last updated:
         <abbr id="data-date" title="{last_updated_date} (UTC timezone)">{timeago.format(new Date(last_updated_date))}</abbr>
       {/if}
+      (<PageLink page="status">Details</PageLink>)
     </div>
   </div>
 </div>
