let build_id = ""; async function fetch_until_ok(uri) { while (true) { try { return await fetch(uri); } catch { } } } async function fetch_build_id() { const response = await fetch_until_ok("/build-id"); const json = await response.json(); return json.build_id; } setInterval(async function() { let new_build_id = await fetch_build_id(); if (build_id !== new_build_id) { location.reload(true); } }, 1000);