Compare commits

...
Author SHA1 Message Date
Graham SteffaniakandCursor 5512d188ac feat(upload): type uploadStallTimeoutSeconds end to end
- store/types: UserObject.fileLoading.uploadStallTimeoutSeconds
- store/mutations: default 10s for new + existing users
- utils/upload: progressTimeoutMs nullish-guards the option
- api/resources: document the onsent callback on post/postPublic signatures

Splits be2b16b0d's upload-stall hunk; base is 493f8f741 (post-merge lockfix).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-14 20:31:34 -06:00
4 changed files with 10 additions and 3 deletions

No files matched your search

+2
View File
@@ -804,6 +804,7 @@ async function downloadChunked(file, shareHash = "") {
* @param {((percent: number) => void) | undefined} [onupload]
* @param {Record<string, string | number>} [headers]
* @param {boolean} [isDir]
* @param {(() => void) | undefined} [onsent]
* @returns {Promise<any> & { xhr?: XMLHttpRequest | null, abort?: () => void }}
*/
export function post(
@@ -1431,6 +1432,7 @@ export function getTextPreviewURLPublic(path, viewToken = state.req?.viewToken)
* @param {((percent: number) => void) | undefined} [onupload]
* @param {Record<string, string | number>} [headers]
* @param {boolean} [isDir]
* @param {(() => void) | undefined} [onsent]
* @returns {Promise<any> & { xhr?: XMLHttpRequest | null, abort?: () => void }}
*/
export function postPublic(
+4
View File
@@ -638,6 +638,7 @@ export const mutations = {
state.user.fileLoading = {
maxConcurrentUpload: 3,
uploadChunkSizeMb: 5,
uploadStallTimeoutSeconds: 10,
downloadChunkSizeMb: 0,
clearAll: false
};
@@ -655,6 +656,9 @@ export const mutations = {
if (state.user.fileLoading.downloadChunkSizeMb === undefined) {
state.user.fileLoading.downloadChunkSizeMb = 0;
}
if (state.user.fileLoading.uploadStallTimeoutSeconds === undefined) {
state.user.fileLoading.uploadStallTimeoutSeconds = 10;
}
}
// Load stored values or use defaults as fallback
+1
View File
@@ -286,6 +286,7 @@ export interface UserObject {
fileLoading?: {
maxConcurrentUpload?: number;
uploadChunkSizeMb?: number;
uploadStallTimeoutSeconds?: number;
clearAll?: boolean;
downloadChunkSizeMb?: number;
maxConcurrent?: number;
+3 -3
View File
@@ -329,9 +329,9 @@ class UploadManager {
try {
const testPath = `${basePath}${dirName}`;
if (getters.isShare()) {
await resourcesApi.postPublic(state.shareInfo?.hash, testPath, new Blob([]), false, undefined, {}, true);
await resourcesApi.postPublic(state.shareInfo?.hash, testPath, new Blob([]), false, undefined, {}, true, undefined);
} else {
await resourcesApi.post(state.req?.source, testPath, new Blob([]), false, undefined, {}, true);
await resourcesApi.post(state.req?.source, testPath, new Blob([]), false, undefined, {}, true, undefined);
}
// No conflict - directory was created successfully
// Mark it so we can skip it later in the queue
@@ -839,7 +839,7 @@ class UploadManager {
}
progressTimeoutMs(): number {
const seconds = state.user?.fileLoading?.uploadStallTimeoutSeconds;
const seconds = state.user?.fileLoading?.uploadStallTimeoutSeconds ?? 0;
return seconds > 0 ? seconds * 1000 : this.PROGRESS_TIMEOUT_MS;
}