Skip to content

Conversation

@gavande1
Copy link
Contributor

@gavande1 gavande1 commented Dec 29, 2025

Related

Fixes STU-1144

Summary

This PR implements file upload progress tracking for sync operations, showing the upload percentage (0-100%) next to the "Uploading Studio site…" message in the UI.

Changes

  • Adds progress updates in real-time as chunks are uploaded via Tus protocol for sync uploads
  • Updated UI component to display upload percentage in parentheses before ellipsis

Testing

  • Checkout this branch
  • Connect your site for sync
  • Start push action with different granular options.
  • Check followings:
    • Test upload progress displays correctly during sync push operations
    • Verify percentage updates smoothly as chunks are uploaded
    • Confirm percentage is cleared when upload completes and transitions to next state
    • Test with various push options to ensure progress calculation is accurate
    • The progress bar also moves with progress between the range of 40%-50%
    • The progress bar also moves with progress between the range of 40%-50% to indicate overall push progress.

@gavande1 gavande1 self-assigned this Dec 29, 2025
@gavande1 gavande1 changed the title Sync: Show file upload progress in % in the UI Sync: Show file upload progress in the UI Dec 30, 2025
@gavande1 gavande1 marked this pull request as ready for review December 30, 2025 05:53
<div className="a8c-body-small flex items-center gap-0.5">
<Icon icon={ info } size={ 16 } />
{ pushState.status.message }
{ getPushUploadMessage( pushState.status.message, uploadPercentage ) }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is best practice but this is best I could come up with. Let me know if you have any better idea to implement this in other way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Could also be memoized with useMemo, but fine as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense. I have updated in 9d16c42

@gavande1 gavande1 requested a review from a team December 30, 2025 05:56
@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2025

📊 Performance Test Results

Comparing 9d16c42 vs trunk

site-editor

Metric trunk 9d16c42 Diff Change
load 7537.00 ms 6081.00 ms -1456.00 ms 🟢 -19.3%

site-startup

Metric trunk 9d16c42 Diff Change
siteCreation 9084.00 ms 9076.00 ms -8.00 ms 🟢 -0.1%
siteStartup 3956.00 ms 3947.00 ms -9.00 ms 🟢 -0.2%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

Copy link
Contributor

@bcotrim bcotrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT and works as described

Image

I added some comments that I think we could address before merging, but not blockers.

return key === 'uploadingPaused';
};

const isKeyUploading = useCallback( ( key: PushStateProgressInfo[ 'key' ] | undefined ) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the isKeyXXX, getPushUploadPercentage, and getPushUploadMessage functions could be defined outside the hook, since they're pure functions with no dependencies on hook state. This provides stable references without the useCallback overhead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Let me refactor them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcotrim I have moved them to pure functions in 4e37ec6. Let me know what do you think?

<div className="a8c-body-small flex items-center gap-0.5">
<Icon icon={ info } size={ 16 } />
{ pushState.status.message }
{ getPushUploadMessage( pushState.status.message, uploadPercentage ) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Could also be memoized with useMemo, but fine as-is.

- Add sync-upload-progress IPC event to send upload progress from main process
- Update Tus onProgress callback to send progress percentage (0-100%)
- Store raw upload progress in SyncPushState for display
- Display upload percentage next to 'Uploading Studio site…' message
- Progress updates in real-time as chunks are uploaded via Tus protocol

Fixes STU-1144
- Move upload progress mapping logic to useSyncStatesProgressInfo hook
- Add getPushUploadMessage helper for i18n-formatted messages
- Add isKeyUploading helper function
- Update message format to show percentage in parentheses: 'Uploading site (98%)…'
- Follow i18n best practices using sprintf for formatted messages
- Centralize all progress-related calculations in one place
@gavande1 gavande1 force-pushed the stu-1144-sync-show-file-upload-progress-in-in-the-ui branch from e41d130 to 9d16c42 Compare January 6, 2026 05:38
Copy link
Contributor

@bcotrim bcotrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes @gavande1
LGTM 👍

Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM and work well! 👍

CleanShot.2026-01-06.at.10.13.05.mp4

Just a small heads up that I've been working on refactoring the pull/push states in #2037. I think we can proceed with merging this and it will be fairly straightforward to resolve any conflicts.

@gavande1 gavande1 merged commit 849442d into trunk Jan 6, 2026
10 checks passed
@gavande1 gavande1 deleted the stu-1144-sync-show-file-upload-progress-in-in-the-ui branch January 6, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants