fix(file-manager): send queued chunks after upload start
Build and publish Docker image / build-and-publish (push) Successful in 13s

This commit is contained in:
wfalkowski committed 2026-10-23 21:41:26 +00:00
1 parent 8e3a6d3446
commit fbcd814ef7
2 files changed
+8 -11

No files matched your search

+4 -9
View File
@@ -287,8 +287,8 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
const uploadInfo = activeUploadsRef.current[chunkFilePath];
const { chunks, currentChunkIndex } = uploadInfo;
// Only send next chunk if connection is ready
if (currentChunkIndex < chunks.length && connectionStatus === 'connected') {
// sendMessage queues the chunk if the socket is reconnecting.
if (currentChunkIndex < chunks.length) {
sendMessage({
type: 'upload_file_chunk',
serverId: serverId,
@@ -308,9 +308,6 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
totalSize: uploadInfo.totalSize
}
}));
} else if (connectionStatus !== 'connected') {
// Connection not ready, chunk will be sent when connection is restored
console.log('Upload paused - WebSocket not connected. Status:', connectionStatus);
}
}
break;
@@ -328,8 +325,8 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
resumeAttemptedRef.current.delete(startedFilePath);
// Reset chunk index to start from beginning (in case of resume)
uploadInfo.currentChunkIndex = 0;
// Only send first chunk if connection is ready
if (chunks.length > 0 && connectionStatus === 'connected') {
// sendMessage queues the chunk if the socket is reconnecting.
if (chunks.length > 0) {
sendMessage({
type: 'upload_file_chunk',
serverId: serverId,
@@ -349,8 +346,6 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
totalSize: uploadInfo.totalSize
}
}));
} else if (connectionStatus !== 'connected') {
console.log('Upload started but connection not ready. Will resume when connected. Status:', connectionStatus);
}
}
break;