Skip to content

Instantly share code, notes, and snippets.

@p-jackson
Created July 26, 2019 04:47
Show Gist options
  • Save p-jackson/145e905a0f6ed727a33670ef18758157 to your computer and use it in GitHub Desktop.
Save p-jackson/145e905a0f6ed727a33670ef18758157 to your computer and use it in GitHub Desktop.
Tweaks import url step so it doesn't override existing steps
diff --git a/client/lib/signup/step-actions.js b/client/lib/signup/step-actions.js
index 973d8a89ad..40eb0967ff 100644
--- a/client/lib/signup/step-actions.js
+++ b/client/lib/signup/step-actions.js
@@ -637,15 +637,18 @@ export function isPlanFulfilled( stepName, defaultDependencies, nextProps ) {
}
export function isSiteTypeFulfilled( stepName, defaultDependencies, nextProps ) {
- let siteType, siteTypeValue;
-
- if ( nextProps.flowName === 'import' ) {
- siteType = siteTypeValue = 'import';
- } else {
- siteType = get( nextProps, [ 'initialContext', 'query', 'site_type' ], null );
- siteTypeValue = getSiteTypePropertyValue( 'slug', siteType, 'slug' );
+ if ( isEmpty( nextProps.initialContext && nextProps.initialContext.query ) ) {
+ return;
}
+ const {
+ initialContext: {
+ query: { site_type: siteType },
+ },
+ } = nextProps;
+
+ const siteTypeValue = getSiteTypePropertyValue( 'slug', siteType, 'slug' );
+
let fulfilledDependencies = [];
if ( siteTypeValue ) {
diff --git a/client/signup/steps/import-url/index.jsx b/client/signup/steps/import-url/index.jsx
index afd43a82a5..cc823896f4 100644
--- a/client/signup/steps/import-url/index.jsx
+++ b/client/signup/steps/import-url/index.jsx
@@ -31,6 +31,7 @@ import {
SITE_IMPORTER_ERR_INVALID_URL,
} from 'lib/importers/constants';
import Notice from 'components/notice';
+import { saveSignupStep } from 'state/signup/progress/actions';
/**
* Style dependencies
@@ -50,6 +51,7 @@ class ImportURLStepComponent extends Component {
};
componentDidMount() {
+ this.props.saveSignupStep( { stepName: this.props.stepName } );
this.setInputValueFromProps();
this.focusInput();
}
@@ -289,6 +291,7 @@ export default flow(
isLoading: isUrlInputDisabled( state ),
} ),
{
+ saveSignupStep,
setNuxUrlInputValue,
recordTracksEvent,
submitImportUrlStep,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment