Onboarding: Allow logo to be removed via customize appearance task (https://github.com/woocommerce/woocommerce-admin/pull/3323)

* Remove pending state when no custom logo ID exists

* Update logo to null in theme mods if removed
This commit is contained in:
Joshua T Flowers 2019-12-03 12:42:57 +08:00 committed by GitHub
parent 09f2a03284
commit fa2ab220c9
1 changed files with 6 additions and 2 deletions

View File

@ -54,7 +54,11 @@ class Appearance extends Component {
const step = this.getSteps()[ stepIndex ].key;
const isRequestSuccessful = ! isRequesting && prevProps.isRequesting && ! hasErrors;
if ( themeMods && prevProps.themeMods.custom_logo !== themeMods.custom_logo ) {
if (
themeMods &&
themeMods.custom_logo &&
prevProps.themeMods.custom_logo !== themeMods.custom_logo
) {
/* eslint-disable react/no-did-update-set-state */
this.setState( { isPending: true } );
wp.media
@ -164,7 +168,7 @@ class Appearance extends Component {
updateLogo() {
const { options, themeMods, updateOptions } = this.props;
const { logo } = this.state;
const updateThemeMods = logo ? { ...themeMods, custom_logo: logo.id } : themeMods;
const updateThemeMods = { ...themeMods, custom_logo: logo ? logo.id : null };
recordEvent( 'tasklist_appearance_upload_logo' );