Jetpack Onboarding: Save site type selection#21154
Conversation
|
|
||
| class JetpackOnboardingSiteTypeStep extends React.PureComponent { | ||
| handleSiteTypeSelection = siteType => { | ||
| const { siteId } = this.props; |
There was a problem hiding this comment.
If you ditched this line and instead just inlined this.props.siteId below, you could collapse the method definition, using some arrow fun:
handleSiteTypeSelection = siteType => () => {
this.props.saveJetpackOnboardingSettings( this.props.siteId, {
siteType,
} );
}
ockham
left a comment
There was a problem hiding this comment.
Looks good. I'm just wondering -- do we even need to store the site type on the backend? Isn't this step simply relevant for the UI, to decide what the next step is?
c256a59 to
15833a8
Compare
TLDR: yes - it would be useful to store it for cases when the user doesn't finish the onboarding flow in one breath, but returns later to complete it. Also, it seems the original plugin stores the site type, so we're only mirroring that functionality: https://github.com/Automattic/jetpack-onboarding/blob/master/class.jetpack-onboarding-end-points.php#L373 |
|
@ockham I intend to merge this one after Automattic/jetpack#8431 lands. Let me know if you have any other suggestions before we 🚢 . |
This PR updates the site type step to be saved in the remote site when clicking the corresponding tile.
To test:
YourJetpackSandbox.comis the domain of your Jetpack sandbox.jpo_site_typeoption was saved topersonal(to check this, go to https://YourJetpackSandbox.com/wp-admin/options.php and look for thejpo_site_typeoption)businessas an option value.