Feature Request
As a developer I could build richer UI experiences if useDeliveryGroupListTarget
exposed it’s internal fetch status.
I am interested in the following states (the names are suggestions):
idle
: The hook cannot fetch (e.g. the shipping address is incomplete).pending
: The hook is actively fetching.success
: The hook has finished fetching.
I’m imagining that the hook would have a new field on it’s return value named fetchStatus
(or something similar).
type DeliveryGroupList = {
deliveryGroups: DeliveryGroup[];
fetchStatus: 'idle' | 'pending' | 'success';
groupType: DeliveryGroupType;
}
Example use case
When there are no delivery groups available due to location and/or cart contents, I want to display a custom component in checkout that shows customers remediation options.
Displaying this custom message at the appropriate time is difficult/impossible with the current API. Developers cannot distinguish between an idle
(or pending
) fetch status versus a success
status with no delivery groups. In both cases, the hook result is either an empty list or undefined.