vuestorefront/vue-storefront

[Bug]: Unable to reload cart when cart exists in useCartFactory

jacobtshirt opened this issue · 1 comments

Describe the Bug

Calling load from useCartFactory does not call factoryParams.load if cart.value is truthy.
https://github.com/vuestorefront/vue-storefront/blob/main/packages/core/src/factories/useCartFactory.ts#L123

Current behavior

consumer of useCartFactory cannot refresh cart from api without first clearing the local cart stored by useCartFactory

Expected behavior

calling load should always call the factoryParams.load function. Leave it to the consumer whether they should use the local state or retrieve from api.

Steps to reproduce

No response

What version of Vue Storefront are you using?

2.7.1

What version of Node.js are you using?

16.17.0

What browser (and version) are you using?

Chrome, Safari, Edge, Firefox

What operating system (and version) are you using?

macOS

Relevant log output

No response

Able to fix / change the documentation?

  • Yes
  • No

Code of Conduct

  • I agree to follow this project's Code of Conduct
Fifciu commented

Nowadays, no eCommerce integration uses useCartFactory. We stopped using useXYZFactories because it wasn't that flexible. The newest version of your integration has useCart not created via useCartFactory. So there won't be an update from us as it's legacy code.

If you are using a legacy version of our software, it would be best to recreate useCart composable on your own, not from factory. This way you can get rid of this condition.