ui init error handler

Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-04-19 12:01:16 +02:00
parent 7b96a2ca69
commit 271a3421d6
3 changed files with 7 additions and 11 deletions
+3 -2
View File
@@ -1270,11 +1270,12 @@ async function initGalleryAutoRefresh() {
let galleryTab = isModern ? document.getElementById('gallery_tabitem') : document.getElementById('tab_gallery');
let timeout = 0;
while (!galleryTab && timeout++ < 60) {
await new Promise((resolve) => { setTimeout(resolve, 1000); });
await new Promise((resolve) => { setTimeout(resolve, 2500); });
galleryTab = isModern ? document.getElementById('gallery_tabitem') : document.getElementById('tab_gallery');
}
if (!galleryTab) {
throw new Error('Timed out waiting for gallery tab element');
error('Gallery: timeout');
return;
}
const displayNoneRegEx = /display:\s*none/;
async function galleryAutoRefresh(mutations) {
+3 -8
View File
@@ -9,15 +9,10 @@ function gradioApp() {
return elem.shadowRoot ? elem.shadowRoot : elem;
}
function logFn(func) {
return async (...args) => {
function logFn(func) { // not recommended: use log, debug or error explicitly
return async function () { // eslint-disable-line func-names
const t0 = performance.now();
let returnValue;
if (func.constructor.name.toLowerCase() === 'asyncfunction') {
returnValue = await func(...args);
} else {
returnValue = func(...args);
}
const returnValue = func(...arguments);
const t1 = performance.now();
log(func.name, `time=${Math.round(t1 - t0)}`);
return returnValue;