Keep the user in the marketing task after installing an extension (#34241)

* Keep the user in the marketing task after installing an extension

* Add changelog
This commit is contained in:
Chi-Hsuan Huang 2022-08-11 08:56:58 +08:00 committed by GitHub
parent 42deef4a52
commit 831c9fcab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import { useMemo, useState } from '@wordpress/element';
import { useSelect, useDispatch } from '@wordpress/data';
import { registerPlugin } from '@wordpress/plugins';
import { WooOnboardingTask } from '@woocommerce/onboarding';
import { getNewPath } from '@woocommerce/navigation';
/**
* Internal dependencies
@ -92,7 +93,7 @@ export const getMarketingExtensionLists = (
};
export type MarketingProps = {
onComplete: ( bool?: boolean ) => void;
onComplete: ( option?: { redirectPath: string } ) => void;
};
const Marketing: React.FC< MarketingProps > = ( { onComplete } ) => {
@ -144,7 +145,9 @@ const Marketing: React.FC< MarketingProps > = ( { onComplete } ) => {
createNoticesFromResponse( response );
setCurrentPlugin( null );
onComplete();
onComplete( {
redirectPath: getNewPath( { task: 'marketing' } ),
} );
} )
.catch( ( response: { errors: Record< string, string > } ) => {
createNoticesFromResponse( response );

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Tweak the marketing task flow after installing a plugin