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

refactor(general): refactor how and where the cart is loaded #605

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

bartoszherba
Copy link
Collaborator

@bartoszherba bartoszherba commented Feb 15, 2022

Description

  • add loadTotalQuantity method on the cart composable as sometimes this is the only information needed
  • add lazy load for a mini cart
  • header will pull only total quantity data instead of loading the whole cart

Related Issue

Motivation and Context

How Has This Been Tested?

Check cart items qty displayed in the header for many scenarios for guest, customer, cart merging etc.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Collaborator

@Frodigo Frodigo left a comment

Choose a reason for hiding this comment

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

Looks great @bartoszherba, I've added only one small suggestion. Besides, please make sure that build passes.

Thanks,,
Marcin

@@ -263,9 +258,7 @@ export default defineComponent({
};

onSSR(async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be great if you change onSSr to useAsync composable from nxutjs/compisition-api

- add loadTotalQuantity method on the cart composable as sometimes this is the only information needed
- add lazy load for a minicart
- header will pull only total quantity data instead of loading whole cart
@bartoszherba bartoszherba force-pushed the M2-182-make-cart-sidebar-lazy-loaded branch from a7539fc to 070a1d3 Compare February 15, 2022 11:21
@Frodigo Frodigo self-requested a review February 15, 2022 12:11
@Frodigo Frodigo merged commit c08bc28 into develop Feb 15, 2022
@Frodigo Frodigo deleted the M2-182-make-cart-sidebar-lazy-loaded branch February 15, 2022 12:11
@Frodigo Frodigo added this to the Stable 1.0.0 release milestone Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants