uga buga kaka

This commit is contained in:
2026-07-15 18:27:45 +02:00
parent 3bbee6029f
commit d9b5b95f54
2 changed files with 26 additions and 1 deletions

View File

@@ -2673,6 +2673,24 @@ window.initUploadForm = (selector) => {
}
}
// Immediately inject the new item into the main grid using the HTTP response data.
// This eliminates the SSE race condition where the async new_item event could
// arrive during or after page navigation and be silently lost.
if (lastData && !lastData.manual_approval && !lastData.pending &&
lastData.itemid && lastData.dest && lastData.mime &&
window.NotificationSystemInstance &&
typeof window.NotificationSystemInstance.handleNewItem === 'function') {
window.NotificationSystemInstance.handleNewItem({
id: lastData.itemid,
dest: lastData.dest,
mime: lastData.mime,
username: lastData.username || window.f0ckSession?.user || '',
display_name: lastData.display_name || window.f0ckSession?.display_name || null,
tag_id: lastData.tag_id ?? 0,
is_oc: !!lastData.is_oc
});
}
// Skip redirect if every item was a background URL job
const allPending = lastData?.pending && selectedFiles.every(i => i.type === 'url');
if (!allPending) {