File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -109,9 +109,10 @@ struct AnalyticsHubView: View {
109109 . edgesIgnoringSafeArea ( . horizontal)
110110 . task {
111111 await viewModel. updateData ( )
112- if viewModel. errorSelectingTimeRange {
113- dismissWithNotice ( notice)
114- }
112+ }
113+ . onReceive ( viewModel. $notice) { notice in
114+ guard let notice else { return }
115+ dismissWithNotice ( notice)
115116 }
116117 }
117118}
Original file line number Diff line number Diff line change @@ -47,15 +47,11 @@ final class AnalyticsHubViewModel: ObservableObject {
4747 ///
4848 @Published var timeRangeCard : AnalyticsTimeRangeCardViewModel
4949
50- /// Defines the current notice that should be shown.
50+ /// Defines a notice that should be shown after the view is dismissed .
5151 /// Defaults to `nil`.
5252 ///
5353 @Published var notice : Notice ?
5454
55- /// Whether selecting a time range failed
56- ///
57- @Published private( set) var errorSelectingTimeRange : Bool = false
58-
5955 // MARK: Private data
6056
6157 /// Order stats for the current selected time period
@@ -82,7 +78,6 @@ final class AnalyticsHubViewModel: ObservableObject {
8278 try await retrieveOrderStats ( )
8379 } catch is AnalyticsHubTimeRangeSelection . TimeRangeGeneratorError {
8480 notice = Notice ( title: Localization . timeRangeGeneratorError, feedbackType: . error)
85- errorSelectingTimeRange = true
8681 DDLogWarn ( " ⚠️ Error selecting analytics time range: \( timeRangeSelectionType. description) " )
8782 } catch {
8883 switchToErrorState ( )
You can’t perform that action at this time.
0 commit comments