Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Woo POS] [Variable Products] Split ItemListState into container and list states #14693

Closed
joshheald opened this issue Dec 16, 2024 · 1 comment · Fixed by #14727
Closed

[Woo POS] [Variable Products] Split ItemListState into container and list states #14693

joshheald opened this issue Dec 16, 2024 · 1 comment · Fixed by #14727
Assignees
Labels
feature: POS type: task An internally driven task.

Comments

@joshheald
Copy link
Contributor

joshheald commented Dec 16, 2024

Description

We currently use ItemListState to define the state of the ItemList, and the fullscreen states used on initial loading of the POS.

The enum effectively defines exactly what should be shown on screen whenever the item list is showing. However, this is defining more than one view at the moment. The fullscreen views are handled by the dashboard, while the loading and loaded views are handled by the ItemListView. We could put all the state handling in the ItemListView and have it pass the fullscreen views up the chain using a preference key, but it would be better to split the state definition up to match what we need.

We'll have a hierarchy of states:

struct ItemsViewState {
    var containerState: ContainerState
    var itemsStackState: ItemsStackState
}

enum ContainerState {
    case loading
    case empty
    case error(PointOfSaleErrorState)
    case content
}

struct ItemsStackState {
    var root: ItemListState
}

enum ItemListState {
    case loading([POSItem])
    case loaded([POSItem])
    case error(PointOfSaleErrorState)
}

In future, we'll expand the stack state to have var itemStates: [POSItem: ItemListState]. That will allow the view to open the child views. In this ticket, it's just about splitting up the container state from the list state.

@jaclync
Copy link
Contributor

jaclync commented Dec 23, 2024

Closed by #14727.

@jaclync jaclync closed this as completed Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: POS type: task An internally driven task.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants