Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add defaults for cart data totals object #1896

Merged
merged 1 commit into from
Mar 9, 2020

Conversation

nerrad
Copy link
Contributor

@nerrad nerrad commented Mar 8, 2020

This was first noticed and implemented as a part of #1780. Since cart.totals is a well-used data property, it is good to have it's shape defined in the default reducer state to prevent undefined errors when implementing.

To Test

This has zero impact on existing code as it's only adding a default expected shape (matching the shape that would get saved to the store). Still, a smoke test of loading the cart would be a good test to verify nothing is broken.

@nerrad nerrad requested a review from a team as a code owner March 8, 2020 19:46
@nerrad nerrad requested review from mikejolley and removed request for a team March 8, 2020 19:46
@nerrad nerrad self-assigned this Mar 8, 2020
@nerrad nerrad added the type: enhancement The issue is a request for an enhancement. label Mar 8, 2020
@nerrad nerrad added this to the Future Release milestone Mar 8, 2020
Copy link
Member

@mikejolley mikejolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I debated doing this but wasn't sure it would be useful.

@nerrad
Copy link
Contributor Author

nerrad commented Mar 9, 2020

Thanks. I debated doing this but wasn't sure it would be useful.

It mostly prevents having to do undefined/nullish checks on the property in consuming code (plus makes typescript linting happy).

@nerrad nerrad merged commit 04bf630 into master Mar 9, 2020
@nerrad nerrad deleted the fix/improve-store-cart-store-defaults branch March 9, 2020 12:52
@nerrad nerrad modified the milestones: Future Release, 2.6.0 Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants