fix: clone — poll until function visible in list, up to 5 attempts (v1.3.85)

This commit is contained in:
“Naeel”
2026-05-09 20:53:17 +04:00
parent f729bbfd85
commit 1ea0c5a9de
3 changed files with 19 additions and 6 deletions
+16 -3
View File
@@ -448,10 +448,23 @@ async function submitClone() {
try {
var data = await requestJSON(API_BASE + '/functions/' + encodeURIComponent(srcName) + '/clone', 'POST', {new_name: newName});
// Успех — закрываем модалку, обновляем список
// Успех — закрываем модалку, ждём появления в списке
closeEdit();
setStatus('Функция «' + newName + '» создана как копия «' + srcName + '»', false);
setTimeout(function() { reloadAll(); }, 800);
showStatus('Клонирование завершено, обновляем список...', '');
var attempts = 0;
async function pollUntilVisible() {
attempts++;
await reloadAll();
var found = (S.fns || []).some(function(f) {
return f && f.metadata && f.metadata.name === newName;
});
if (found || attempts >= 5) {
showStatus('Функция «' + newName + '» создана как копия «' + srcName + '»', 'ok');
} else {
setTimeout(pollUntilVisible, 1000);
}
}
setTimeout(pollUntilVisible, 700);
} catch(e) {
if (errEl) { errEl.textContent = e.message; errEl.style.display = 'block'; }
} finally {