X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/d7fc469d21068cd4812ede69677490c96292dd6d..3ef71c2a94b11b8c5728e8daed048b992b895a41:/src/components/LastUpdated.svelte?ds=inline diff --git a/src/components/LastUpdated.svelte b/src/components/LastUpdated.svelte index a51b4b6..44738f2 100644 --- a/src/components/LastUpdated.svelte +++ b/src/components/LastUpdated.svelte @@ -6,11 +6,18 @@ 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; }); });