Sfoglia il codice sorgente

improve reconnect when accessing via On Air

Rodja Trappe 1 anno fa
parent
commit
2bfd7f5663
1 ha cambiato i file con 2 aggiunte e 4 eliminazioni
  1. 2 4
      nicegui/templates/index.html

+ 2 - 4
nicegui/templates/index.html

@@ -272,13 +272,11 @@
                 window.location.reload(); // see https://github.com/zauberzeug/nicegui/issues/198
               }
             },
-            try_reconnect: () => {
-              const checkAndReload = async () => {
+            try_reconnect: async () => {
+                document.getElementById('popup').style.opacity = 1;
                 await fetch(window.location.href, { headers: { 'NiceGUI-Check': 'try_reconnect' } });
                 console.log('reloading because reconnect was requested')
                 window.location.reload();
-              };
-              setInterval(checkAndReload, 500);
             },
             disconnect: () => {
               document.getElementById('popup').style.opacity = 1;