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

[ShopperBaskets] - added logic to update cache for multiple baskets on basket mutations #2148

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

MarkLabe
Copy link

@MarkLabe MarkLabe commented Nov 26, 2024

Description

Issue 2147
#2147
If customer has more than 1 baskets, then on any basket related mutations cache is updated only for first one

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Changes

Add 2 flags to handle new baskets cache update (isBasketNew and basketsTotal),
Added logic to merge data for new basket

How to Test-Drive This PR

  1. In overrides\app\hooks\ShopperBaskets\mutation.ts add hardcoded value before return client.clientConfig.parameters.version = 'v2'. We need this to create temp basket (it's impossible to make in scapi v1)
  2. make first mutation for regular basket using useShopperBasketsMutation('createBasket')
  3. make second mutation for temp basket using same mutation with such code:
  4. createBasket.mutate({ parameters: {temporary: true}, body: <> })
  5. place a debugger in src\hooks\ShopperBaskets\cache.ts updateCustomerBasketsQuery
  6. check that durring second mutation updateCustomerBasketsQuery -> updater returns
    both baskets

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

…ations

Signed-off-by: Mark <34482614+MarkLabe@users.noreply.github.com>
@vcua-mobify
Copy link
Contributor

The changes here make sense to me but I'll let someone who is more familiar with this area go over this as well.

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