@@ -110,7 +110,6 @@ private extension StoreStatsAndTopPerformersViewController {
110110 defer {
111111 group. notify ( queue: . main) { [ weak self] in
112112 self ? . isSyncing = false
113- self ? . removeGhostContent ( )
114113 self ? . showSpinner ( shouldShowSpinner: false )
115114 if let error = syncError {
116115 DDLogError ( " ⛔️ Error loading dashboard: \( error) " )
@@ -151,8 +150,12 @@ private extension StoreStatsAndTopPerformersViewController {
151150 // For tasks dispatched for each time period.
152151 let periodGroup = DispatchGroup ( )
153152
153+ // For tasks dispatched for store stats (order and visitor stats) for each time period.
154+ let periodStoreStatsGroup = DispatchGroup ( )
155+
154156 group. enter ( )
155157 periodGroup. enter ( )
158+ periodStoreStatsGroup. enter ( )
156159 self . syncStats ( for: siteID,
157160 siteTimezone: timezoneForSync,
158161 timeRange: vc. timeRange,
@@ -166,10 +169,12 @@ private extension StoreStatsAndTopPerformersViewController {
166169 }
167170 group. leave ( )
168171 periodGroup. leave ( )
172+ periodStoreStatsGroup. leave ( )
169173 }
170174
171175 group. enter ( )
172176 periodGroup. enter ( )
177+ periodStoreStatsGroup. enter ( )
173178 self . syncSiteVisitStats ( for: siteID,
174179 siteTimezone: timezoneForSync,
175180 timeRange: vc. timeRange,
@@ -180,6 +185,7 @@ private extension StoreStatsAndTopPerformersViewController {
180185 }
181186 group. leave ( )
182187 periodGroup. leave ( )
188+ periodStoreStatsGroup. leave ( )
183189 }
184190
185191 group. enter ( )
@@ -194,6 +200,8 @@ private extension StoreStatsAndTopPerformersViewController {
194200 }
195201 group. leave ( )
196202 periodGroup. leave ( )
203+
204+ vc. removeTopPerformersGhostContent ( )
197205 }
198206
199207 periodGroup. notify ( queue: . main) {
@@ -204,6 +212,10 @@ private extension StoreStatsAndTopPerformersViewController {
204212 syncError = periodSyncError
205213 }
206214 }
215+
216+ periodStoreStatsGroup. notify ( queue: . main) {
217+ vc. removeStoreStatsGhostContent ( )
218+ }
207219 }
208220 }
209221
@@ -225,27 +237,12 @@ private extension StoreStatsAndTopPerformersViewController {
225237 /// Displays the Ghost Placeholder whenever there is no visible data.
226238 ///
227239 func ensureGhostContentIsDisplayed( ) {
228- guard visibleChildViewController. shouldDisplayStoreStatsGhostContent else {
229- return
240+ periodVCs. forEach { periodVC in
241+ guard periodVC. shouldDisplayStoreStatsGhostContent else {
242+ return
243+ }
244+ periodVC. displayGhostContent ( )
230245 }
231-
232- displayGhostContent ( )
233- }
234-
235- /// Locks UI Interaction and displays Ghost Placeholder animations.
236- ///
237- func displayGhostContent( ) {
238- view. isUserInteractionEnabled = false
239- buttonBarView. startGhostAnimation ( style: . wooDefaultGhostStyle)
240- visibleChildViewController. displayGhostContent ( )
241- }
242-
243- /// Unlocks the and removes the Placeholder Content
244- ///
245- func removeGhostContent( ) {
246- view. isUserInteractionEnabled = true
247- buttonBarView. stopGhostAnimation ( )
248- visibleChildViewController. removeGhostContent ( )
249246 }
250247
251248 /// If the Ghost Content was previously onscreen, this method will restart the animations.
0 commit comments