woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
299 stars 110 forks source link

[Woo POS] Improvement: Dashboard state handling #13797

Open iamgabrielma opened 2 weeks ago

iamgabrielma commented 2 weeks ago

The current state of PointOfSaleDashboardView Is driven by multiple @Published booleans within PointOfSaleDashboardViewModel:

@Published var isInitialLoading: Bool = false
@Published var isError: Bool = false
@Published var isEmpty: Bool = false

While this currently works as expected, these states are mutually exclusive so it would make more sense to design as a single enum within the view model, so we do not risk to be in an incorrect state where two of more could be true at the same time. Eg:

enum DashboardState {
  case empty
  case initialLoading
  case error
 ...
}
dangermattic commented 2 weeks ago

Thanks for reporting! 👍