Skip to content

Commit

Permalink
Merge pull request #13140 from wordpress-mobile/fix/13138-stats_data
Browse files Browse the repository at this point in the history
Stats: force refresh when Period changes
  • Loading branch information
ScoutHarris committed Dec 19, 2019
2 parents 8c26035 + bce8565 commit f622490
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Expand Up @@ -11,6 +11,7 @@
* Block editor: Images from Image Block can now be previewed full screen by tapping on them.
* Fixed an issue that caused logging in with a 2FA Google account to fail.
* Sign in with Apple: now supports logging in with 2FA enabled on linked WordPress accounts.
* Stats: Fixed issue that caused incorrect data to be displayed.

13.7
-----
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Classes/Stores/StatsPeriodStore.swift
Expand Up @@ -1058,6 +1058,8 @@ private extension StatsPeriodStore {
operationQueue.cancelAllOperations()

statsServiceRemote?.wordPressComRestApi.invalidateAndCancelTasks()
setAllFetchingStatus(.idle)

// `invalidateAndCancelTasks` invalidates the SessionManager,
// so we need to recreate it to run queries.
initializeStatsRemote()
Expand Down
Expand Up @@ -211,7 +211,7 @@ class SiteStatsPeriodViewModel: Observable {

lastRequestedDate = date
lastRequestedPeriod = period
ActionDispatcher.dispatch(PeriodAction.refreshPeriodOverviewData(date: date, period: period, forceRefresh: false))
ActionDispatcher.dispatch(PeriodAction.refreshPeriodOverviewData(date: date, period: period, forceRefresh: true))
}

// MARK: - State
Expand Down

0 comments on commit f622490

Please sign in to comment.