diff --git a/Gemfile.lock b/Gemfile.lock index 939ac56230d3..a02fde0861da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -396,4 +396,4 @@ DEPENDENCIES xcpretty-travis-formatter BUNDLED WITH - 2.3.22 + 2.3.23 diff --git a/WordPress/Classes/ViewRelated/Stats/SiteStatsDashboardViewController.swift b/WordPress/Classes/ViewRelated/Stats/SiteStatsDashboardViewController.swift index 39936a702d9b..13770c892c93 100644 --- a/WordPress/Classes/ViewRelated/Stats/SiteStatsDashboardViewController.swift +++ b/WordPress/Classes/ViewRelated/Stats/SiteStatsDashboardViewController.swift @@ -198,12 +198,17 @@ private extension SiteStatsDashboardViewController { private extension SiteStatsDashboardViewController { func saveSelectedPeriodToUserDefaults() { - guard let siteID = SiteStatsInformation.sharedInstance.siteID?.intValue, - !insightsTableViewController.isGrowAudienceShowing else { + guard let siteID = SiteStatsInformation.sharedInstance.siteID?.intValue else { return } let key = Self.lastSelectedStatsPeriodTypeKey(forSiteID: siteID) + + guard !insightsTableViewController.isGrowAudienceShowing else { + UserPersistentStoreFactory.instance().set(StatsPeriodType.insights.rawValue, forKey: key) + return + } + UserPersistentStoreFactory.instance().set(currentSelectedPeriod.rawValue, forKey: key) }