Reducers
Last Updated - Platform 18.1 - SDK 13.0Reducers handle updating the data presented by a feature.
Data changes
.withServiceReducer(.productListService)
Reducer to update the state when the ProductList
is (or will be) retrieved or updated in response to service actions.
This is the main reducer that powers the Product List feature.
Handles the following actions:
ServiceAction.ProductList.fetch: Updates state.data
to a paging state of .loading
which is presented as a loading screen.
ServiceAction.ProductList.fetchPage: Updates state.data.next
to .loading
which is presented as a loading spinner at the bottom to show it is loading the next page.
ServiceAction.ProductList.fetched: Updates the state.data
to either failure
which is presented by an ErrorView
, or the ProductList
data which is presented by the ProductListView
. Does nothing if the filters and sort do not match those of the current state.
ServiceAction.ProductList.fetchedPage: Updates either the state.data.next
to failure
which is presented by a CompactErrorView
at the bottom, or the state.data
which refreshes the currently presented ProductListView
. Does nothing if the filters and sort do not match those of the current state.
Filter changes
.withFilterSelectionReducer(.filterSelection)
Reducer to update the state when the Filter
selection is changed in response to the Filter Selection delegate middleware.
Handles the following actions:
FilterSelectionAction: Updates state.filters.selected
with the new filters value.
Sort order changes
.withSortSelectionReducer(.sortSelection)
Reducer to update the state when the SortOrder
selection is changed in response to the Sort Selection delegate middleware.
Handles the following actions:
SortSelectionAction: Updates state.sort.selected
with the new sort order value.