Skip to content

Commit

Permalink
Site importer: fix for issue where site import preview persists from …
Browse files Browse the repository at this point in the history
…previous import (Automattic#35930)

* New clearSiteImporterImport action.

* Using new clearSiteImporterImport action when SiteImporterInputPane is mounted, to clear any lingering state from previous imports.
  • Loading branch information
andfinally authored Sep 2, 2019
1 parent 56ad530 commit 013e553
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
validateSiteIsImportable,
resetSiteImporterImport,
setValidationError,
clearSiteImporterImport,
} from 'state/imports/site-importer/actions';
import ImporterActionButton from 'my-sites/importer/importer-action-buttons/action-button';
import ImporterCloseButton from 'my-sites/importer/importer-action-buttons/close-button';
Expand Down Expand Up @@ -63,6 +64,12 @@ class SiteImporterInputPane extends React.Component {
};

componentDidMount() {
const { importStage } = this.props;
if ( 'importable' === importStage ) {
// Clear any leftover state from previous imports
this.props.clearSiteImporterImport();
}

this.validateSite();

if ( config.isEnabled( 'manage/import/site-importer-endpoints' ) ) {
Expand Down Expand Up @@ -338,6 +345,7 @@ export default flowRight(
importSite,
validateSiteIsImportable,
resetSiteImporterImport,
clearSiteImporterImport,
setValidationError,
}
),
Expand Down
4 changes: 4 additions & 0 deletions client/state/imports/site-importer/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,7 @@ export const resetSiteImporterImport = ( { importStage, site, targetSiteUrl } )
} ),
{ type: SITE_IMPORTER_IMPORT_RESET }
);

export const clearSiteImporterImport = () => ( {
type: SITE_IMPORTER_IMPORT_RESET,
} );

0 comments on commit 013e553

Please sign in to comment.