pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[feature]: Cart event pub/sub

Open abrhim opened this issue 4 years ago • 4 comments

Is your feature request related to a problem? Please describe. Data Solutions uses cart events to track user behavior. Right now we are looking thru Peregrine to find talons and wrapping handleAddToCart and handleRemoveFromCart functions, but this is proving to be difficult because these functions are callbacks called within a react hook later. This removes the ability to call any of our custom hooks within these functions.

Describe the solution you'd like An internal pub/sub that publishes cart events.

Describe alternatives you've considered wrapping the useMiniCart and hitting the graphql cache on every render, maintaining the previous value and comparing it to the current to determine if items were added/removed from cart.

Additional context none

Please let us know what packages this feature is in regards to:

  • [ ] venia-concept
  • [ ] venia-ui
  • [ ] pwa-buildpack
  • [x] peregrine
  • [ ] pwa-devdocs
  • [ ] upward-js
  • [ ] upward-spec
  • [ ] create-pwa

abrhim avatar Feb 03 '21 18:02 abrhim

Hi @abrhim. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Feb 03 '21 18:02 m2-assistant[bot]

@magento export issue to JIRA project PWA as Story

sirugh avatar Feb 09 '21 15:02 sirugh

:white_check_mark: Jira issue (https://jira.corp.magento.com/browse/PWA-1444) is successfully created for this issue.

github-jira-sync-bot avatar Feb 09 '21 15:02 github-jira-sync-bot

This is blocked internally by a spike to research possibilities for a secure, built-in eventing system, PWA-1389.

sirugh avatar Mar 01 '21 15:03 sirugh