Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Checkout/Cart: Consolidate all interactions in components with context #1942

Closed
nerrad opened this issue Mar 11, 2020 · 3 comments
Closed

Checkout/Cart: Consolidate all interactions in components with context #1942

nerrad opened this issue Mar 11, 2020 · 3 comments
Labels
block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: enhancement The issue is a request for an enhancement. type: refactor The issue/PR is related to refactoring.

Comments

@nerrad
Copy link
Contributor

nerrad commented Mar 11, 2020

Note: This is a stretch goal and not intended for the initial release of the blocks.

Right now we use hooks directly in the various components, but it'd be good to have everything flow through the contexts (Checkout/CartProvider, PaymentMethodPaymentProvider, ShippingMethodDataProvider). This could mean using the relevant context hooks directly, or new hooks that expose just a slice of context (for descriptive application).

Rationale:

  • Logic related to data, status, state etc is maintained in the the context.
  • Contexts can still use the data stores (and relevant hooks), but we can keep those interfaces private and selectively control the public interface (via the context) for extensibility.
  • Status management is more centralized and thus easier to maintain.
  • Components are more decoupled because if they are not used within a context provider, they will use the default (shimmed and nooped) state exposed on the context hooks. This allows for potential use of some components outside of cart/checkout.
  • There is clearer flow for checkout/cart data within the contexts.
  • While not verified, I think contexts will potentially work better with React.Suspense api (for potential future iterations).
@nerrad nerrad added category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: enhancement The issue is a request for an enhancement. type: refactor The issue/PR is related to refactoring. labels Mar 11, 2020
@nerrad nerrad added this to the Future Release milestone Mar 11, 2020
@nerrad nerrad removed this from the Future Release milestone May 1, 2020
@nerrad nerrad added block: checkout Issues related to the checkout block. block: cart Issues related to the cart block. labels Jun 7, 2020
@github-actions
Copy link
Contributor

This issue has been marked as stale because it has not seen any activity within the past 60 days. Our team uses this tool to help surface issues for review. If you are the author of the issue there's no need to comment as it will be looked at.

######Internal: After 10 days with no activity this issue will be automatically be closed.

@github-actions github-actions bot added the status: stale Stale issues and PRs have had no updates for 60 days. label Dec 17, 2020
@nerrad nerrad removed the status: stale Stale issues and PRs have had no updates for 60 days. label Jan 5, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2021

This issue has been marked as stale because it has not seen any activity within the past 60 days. Our team uses this tool to help surface issues for review. If you are the author of the issue there's no need to comment as it will be looked at.

Internal: After 10 days with no activity this issue will be automatically be closed.

@github-actions github-actions bot added the status: stale Stale issues and PRs have had no updates for 60 days. label Mar 7, 2021
@nerrad nerrad removed the status: stale Stale issues and PRs have had no updates for 60 days. label Mar 10, 2021
@nerrad
Copy link
Contributor Author

nerrad commented Mar 10, 2021

I'm going to close this issue. Some of this is done, and some of this is accomplished through various refactors as we tighten up how data flows through the app for various needs we work on. So as a separate issue for work to do, I don't think there is much value at this point.

@nerrad nerrad closed this as completed Mar 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: enhancement The issue is a request for an enhancement. type: refactor The issue/PR is related to refactoring.
Projects
None yet
Development

No branches or pull requests

1 participant