SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
744 stars 389 forks source link

Change getOrdersLoaded selector #1258

Closed znikola closed 5 years ago

znikola commented 5 years ago

There's an inconsistency in getOrdersLoaded selector:

export const getOrdersLoaded: MemoizedSelector<
  StateWithUser,
  boolean
> = createSelector(
  getOrdersState,
  (state: LoaderState<OrderHistoryList>) => loaderLoadingSelector(state)
);

Its name is suggesting usage of loaded or success flags, but we are returning loading flag.

In the html (projects/storefrontlib/src/lib/my-account/order/order-history/order-history.component.html) template, this is used for displaying "We have no order records for this account" message.

We should use success flag and rename methods/selectors/properties to have consistent names.

WeizhengSap commented 5 years ago

In this ticket, I QA the ticket #1137 first. It works fine.

WeizhengSap commented 5 years ago

The steps to QA this ticket:

  1. register a new user
  2. go to my-account/order history page, you should be able to see "We have no order records for this account."
WeizhengSap commented 5 years ago

PR is here: https://github.com/SAP/cloud-commerce-spartacus-storefront/pull/1271