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

fix(medusa): Avoid unnecessary cart updates upon retrieval #2443

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

dwene
Copy link
Contributor

@dwene dwene commented Oct 13, 2022

Fetch-cart was always updating the cart when a user was logged in, because there was a missing select for email. See the lines below:

// If there is a logged in user add the user to the cart
  if (req.user && req.user.customer_id) {
    if (
      !cart.customer_id ||
      !cart.email ||
      cart.customer_id !== req.user.customer_id
    ) {
      await cartService.update(id, {
        customer_id: req.user.customer_id,
      })
    }
  }

@dwene dwene requested a review from a team as a code owner October 13, 2022 22:51
@changeset-bot
Copy link

changeset-bot bot commented Oct 13, 2022

🦋 Changeset detected

Latest commit: d3d86af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@medusajs/medusa Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@olivermrbl
Copy link
Contributor

Nice catch @dwene! Appreciate the contribution 💪

@olivermrbl
Copy link
Contributor

Can I get you to add a changeset with a patch bump?

To do so, you'll have to run:

  1. yarn changeset
  2. Choose @medusajs/medusa
  3. Hit enter, hit enter
  4. Write a short summary of the change
  5. Commit + push

@olivermrbl olivermrbl changed the title fix: always updating cart when fetching cart fix(medusa): Avoid unnecessary cart updates upon retrieval Nov 3, 2022
@olivermrbl
Copy link
Contributor

@dwene Can I get you to update the PR?

@dwene
Copy link
Contributor Author

dwene commented Nov 23, 2022

@olivermrbl done!

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

LGTM, waiting for the CI to pass 💪

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.

None yet

2 participants