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

[BUG] Basket - Query Cache update for users with multiple baskets #2147

Open
MarkLabe opened this issue Nov 26, 2024 · 1 comment
Open

[BUG] Basket - Query Cache update for users with multiple baskets #2147

MarkLabe opened this issue Nov 26, 2024 · 1 comment

Comments

@MarkLabe
Copy link

Summary

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

Steps To Reproduce #1

  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)

  1. make first mutation for regular basket using useShopperBasketsMutation('createBasket')
  2. make second mutation for temp basket using same mutation with such code:
    createBasket.mutate({ parameters: {temporary: true}, body: <<tempBasketBody>> })
  3. place a debugger in src\hooks\ShopperBaskets\cache.ts
    updateCustomerBasketsQuery
  4. check that durring second mutation updateCustomerBasketsQuery -> updater returns
    only info with already existing basket

Steps To Reproduce #2 (I haven't tested this one)

  1. Use useShopperBasketsMutation('createBasket') multiple times durring same session
  2. Place a debugger in src\hooks\ShopperBaskets\cache.ts
    updateCustomerBasketsQuery

Expected result

Basket list should consist of all baskets not just old ones

Actual result

Basket list consist of only old(already existing) baskets

System Information (as applicable)

Browser: -
Node version: -
pwa-kit version: 3.8.x
Desktop OS: -
Mobile Device Info: -

@MarkLabe
Copy link
Author

PR: #2148

@MarkLabe MarkLabe reopened this Nov 26, 2024
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

No branches or pull requests

1 participant