Skip to content

Commit

Permalink
Set the state to 'backing-up' immediately the user starts a migration…
Browse files Browse the repository at this point in the history
…, so the UI locks sooner. Unlock the UI if the status is 'done'. (#38684)
  • Loading branch information
andfinally authored Jan 7, 2020
1 parent cc3d6ac commit b288baa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions client/my-sites/migrate/section-migrate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class SectionMigrate extends Component {
return;
}

this.setMigrationState( { migrationStatus: 'backing-up' } );

wpcom
.startMigration( sourceSiteId, targetSiteId )
.then( () => this.updateFromAPI() )
Expand Down
7 changes: 5 additions & 2 deletions client/state/selectors/is-site-migration-in-progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import getSiteMigrationStatus from 'state/selectors/get-site-migration-status';

/**
* Returns true if the site is the target of an active migration
* Returns true if the site is the target of an active migration.
* Possible migration statuses: inactive, backing-up, restoring, error, done.
* We regard 'error' as 'in progress' – the user needs to dismiss that
* state.
*
* @param {object} state Global state tree
* @param {object} siteId Site ID
Expand All @@ -14,5 +17,5 @@ import getSiteMigrationStatus from 'state/selectors/get-site-migration-status';
export default function isSiteMigrationInProgress( state, siteId ) {
const migrationStatus = getSiteMigrationStatus( state, siteId );

return migrationStatus !== 'inactive';
return migrationStatus !== 'inactive' && migrationStatus !== 'done';
}

0 comments on commit b288baa

Please sign in to comment.