feat(uploads-manager): add upload progress and time left to uploads manager#4720
feat(uploads-manager): add upload progress and time left to uploads manager#4720pierre-pigeon wants to merge 12 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
pgolebiowski seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughContentUploader now supports optional upload ETA and byte-progress telemetry. ETA state is sampled and smoothed per upload, reset between attempts, and conditionally mapped into modernized upload items. Types, dependency versions, tests, and a Storybook example were updated. ChangesUpload ETA integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant UploadEvent
participant ContentUploader
participant updateEta
participant mapToModernizedUploadItems
participant UploadsManager
UploadEvent->>ContentUploader: loaded and total progress
ContentUploader->>updateEta: update per-item ETA state
updateEta-->>ContentUploader: smoothed remainingMs
ContentUploader->>mapToModernizedUploadItems: upload items and ETA flag
mapToModernizedUploadItems-->>UploadsManager: byte and ETA fields
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/elements/content-uploader/utils/mapToModernizedUploadItem.ts`:
- Around line 63-65: Update mapToModernizedUploadItem so items with
item.isFolder do not populate totalBytes, bytesUploaded, or remainingMs,
regardless of upload status or ETA configuration. Preserve the existing byte and
ETA calculations for non-folder file items.
- Around line 64-66: Update the remainingMs mapping in mapToModernizedUploadItem
so errored and canceled statuses return undefined rather than forwarding the
stale fileItem.remainingMs value. Preserve the existing ETA for active,
non-terminal upload statuses and keep staged/complete behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7753101d-bae6-4a3b-a09d-255e8550dfac
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
package.jsonsrc/common/types/upload.jssrc/elements/content-uploader/ContentUploader.tsxsrc/elements/content-uploader/__tests__/ContentUploader.test.jssrc/elements/content-uploader/stories/ContentUploader.stories.jssrc/elements/content-uploader/utils/__tests__/mapToModernizedUploadItem.test.tssrc/elements/content-uploader/utils/__tests__/uploadEta.test.tssrc/elements/content-uploader/utils/mapToModernizedUploadItem.tssrc/elements/content-uploader/utils/uploadEta.ts
821a657 to
71f4dc3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/elements/content-uploader/ContentUploader.tsx (1)
1273-1275: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winSkip ETA sampling when the feature is disabled.
isUploadEtaEnabledonly controls mapping, so every upload still invokesupdateEtaand allocates sampling arrays while the mapper drops the result. Guard this telemetry block with the feature flag to avoid adding work to the existing progress hot path.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/elements/content-uploader/ContentUploader.tsx` around lines 1273 - 1275, Guard the ETA telemetry block in the upload progress handler with isUploadEtaEnabled so updateEta and etaByItem.set are skipped when the feature is disabled. Preserve the existing progress handling and only sample or store ETA data when the flag is enabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/elements/content-uploader/ContentUploader.tsx`:
- Around line 1276-1278: Update handleUploadError and markItemCanceled to clear
item.remainingMs and remove the corresponding etaByItem entry when an upload
fails or is canceled. Preserve ETA updates for in-progress uploads and ensure
failed/canceled rows cannot retain stale time remaining.
---
Nitpick comments:
In `@src/elements/content-uploader/ContentUploader.tsx`:
- Around line 1273-1275: Guard the ETA telemetry block in the upload progress
handler with isUploadEtaEnabled so updateEta and etaByItem.set are skipped when
the feature is disabled. Preserve the existing progress handling and only sample
or store ETA data when the flag is enabled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e9847b8e-6c4f-4824-bd01-3829e251a1ed
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
package.jsonsrc/common/types/upload.jssrc/elements/content-uploader/ContentUploader.tsxsrc/elements/content-uploader/__tests__/ContentUploader.test.jssrc/elements/content-uploader/stories/ContentUploader.stories.jssrc/elements/content-uploader/utils/__tests__/mapToModernizedUploadItem.test.tssrc/elements/content-uploader/utils/__tests__/uploadEta.test.tssrc/elements/content-uploader/utils/mapToModernizedUploadItem.tssrc/elements/content-uploader/utils/uploadEta.ts
🚧 Files skipped from review as they are similar to previous changes (8)
- package.json
- src/elements/content-uploader/utils/mapToModernizedUploadItem.ts
- src/elements/content-uploader/tests/ContentUploader.test.js
- src/elements/content-uploader/utils/uploadEta.ts
- src/common/types/upload.js
- src/elements/content-uploader/utils/tests/uploadEta.test.ts
- src/elements/content-uploader/utils/tests/mapToModernizedUploadItem.test.ts
- src/elements/content-uploader/stories/ContentUploader.stories.js
| } | ||
|
|
||
| const totalBytes = fileItem.totalBytes ?? item.size; | ||
| const isFullyUploaded = status === 'staged' || status === 'complete'; |
There was a problem hiding this comment.
let's use constants here instead of strings
| const isFullyUploaded = status === 'staged' || status === 'complete'; | |
| const isFullyUploaded = status === STATUS_STAGED || status === STATUS_COMPLETE; |
| "@box/types": "^2.1.8", | ||
| "@box/unified-share-modal": "^2.15.16", | ||
| "@box/uploads-manager": "^1.17.2", | ||
| "@box/uploads-manager": "^2.4.0", |
|
|
||
| // Drop byte/ETA progress from the previous attempt | ||
| item.bytesUploaded = 0; | ||
| item.remainingMs = undefined; |
There was a problem hiding this comment.
Do we need to clear item.totalBytes here too?
This PR enriches the modernized uploads manager with per-item byte progress and a smoothed time-remaining (ETA) estimate.
ContentUploadernow tracksbytesUploaded/totalBytesfrom upload progress events and computes an EMA-smoothed ETA.Summary by CodeRabbit