Disable task list on analytics dashboard when homepage is enabled. (https://github.com/woocommerce/woocommerce-admin/pull/4617)

Regression from 8a2750c973.
This commit is contained in:
Jeff Stieler 2020-06-18 10:56:30 -04:00 committed by GitHub
parent 7aa053a133
commit 9794fed139
2 changed files with 15 additions and 1 deletions

View File

@ -73,6 +73,7 @@ const mergeSectionsWithDefaults = ( prefSections ) => {
const CustomizableDashboard = ( {
defaultDateRange,
homepageEnabled,
path,
query,
taskListComplete,
@ -92,7 +93,7 @@ const CustomizableDashboard = ( {
const sections = dashSections || defaultSections;
const isTaskListEnabled = isOnboardingEnabled() && ! taskListHidden;
const isTaskListEnabled = ! homepageEnabled && isOnboardingEnabled() && ! taskListHidden;
const isDashboardShown =
! isTaskListEnabled || ( ! query.task && taskListComplete );

View File

@ -45,6 +45,7 @@ class AnalyticsDashboard {
add_action( 'admin_menu', array( $this, 'register_page' ) );
// priority is 20 to run after https://github.com/woocommerce/woocommerce/blob/a55ae325306fc2179149ba9b97e66f32f84fdd9c/includes/admin/class-wc-admin-menus.php#L165.
add_action( 'admin_head', array( $this, 'update_link_structure' ), 20 );
add_filter( 'woocommerce_admin_preload_options', array( $this, 'preload_options' ) );
}
/**
@ -78,6 +79,18 @@ class AnalyticsDashboard {
);
}
/**
* Preload options to prime state of the application.
*
* @param array $options Array of options to preload.
* @return array
*/
public function preload_options( $options ) {
$options[] = 'woocommerce_homescreen_enabled';
return $options;
}
/**
* Registers dashboard page.
*/