Skip to content

Display sidebar spinner during export - #1071

Merged
fredrikekelund merged 1 commit into
trunkfrom
f26d/display-sidebar-spinner-during-export
Mar 17, 2025
Merged

Display sidebar spinner during export#1071
fredrikekelund merged 1 commit into
trunkfrom
f26d/display-sidebar-spinner-during-export

Conversation

@fredrikekelund

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

  • Display a spinner in the main sidebar when exporting a site (to match the behavior when importing a site).
Screenshot 2025-03-14 at 16 40 54

Testing Instructions

  1. Have a Studio site
  2. Go to the Import/Export tab and export the entire site
  3. Ensure that a spinner is displayed in the sidebar until the operation is complete
  4. Export just the database
  5. Ensure that a spinner is displayed in the sidebar until the operation is complete

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@fredrikekelund
fredrikekelund requested a review from a team March 14, 2025 15:43
@fredrikekelund fredrikekelund self-assigned this Mar 14, 2025

@ivan-ottinger ivan-ottinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The proposed changes look good. The spinner is rendering correctly when the site is being exported.

Good idea of adding it in the first place. It makes the experience consistent. 👌🏼

...currentProgress,
statusMessage: __( 'Backing up files...' ),
progress: Math.min( 100, 20 + entriesProgress * 80 ), // Backup creation takes progress from 20% to 100%
progress: Math.min( 95, 20 + entriesProgress * 80 ), // Backup creation takes progress from 20% to 95%

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is not clear to me why is this change needed? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. It's because I made the logic in isSiteExporting check that progress < 100 (identical to isSiteImporting). However, the BACKUP_CREATE_PROGRESS event handler would previously increment the progress all the way up to 100, which made the sidebar spinner disappear before the export was actually complete.

This change makes the event handler stop the progress at 95.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, that makes sense.

@fredrikekelund
fredrikekelund merged commit 7f15dbd into trunk Mar 17, 2025
@fredrikekelund
fredrikekelund deleted the f26d/display-sidebar-spinner-during-export branch March 17, 2025 08:43
bgrgicak pushed a commit that referenced this pull request Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants