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

Investigate if we can replace useCheckoutAddress hook with direct interactions with wc/store/checkout #6581

Closed
Tracked by #6625
opr opened this issue Jun 16, 2022 · 4 comments
Assignees
Labels
block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. type: refactor The issue/PR is related to refactoring. type: technical debt This issue/PR represents/solves the technical debt of the project.

Comments

@opr
Copy link
Contributor

opr commented Jun 16, 2022

We have a hook: useCheckoutAddress which, following #6455 is mostly an abstraction to the selectors and actions on the wc/store/checkout @wordpress/data store with a couple of extra functions and propertoes.

We should investigate if it is worthwhile removing this hook. The abstraction adds extra complexity to our codebase, and if we can avoid it we should.

If we do this, we will also need to add actions and cases in the reducer to handle the following:

  • setEmail
  • setBillingPhone
  • setShippingPhone

And new selectors:

  • defaultAddressFields
  • showShippingFields
  • showBillingFields
@opr opr added type: refactor The issue/PR is related to refactoring. needs feedback block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. type: technical debt This issue/PR represents/solves the technical debt of the project. labels Jun 16, 2022
@senadir
Copy link
Member

senadir commented Jun 20, 2022

We should explore the model of saveEntity, editEntity of Gutenberg in which one is a local edit and the other is persisted to the server, this should replace the need for pushChanges either that or explore using thunks for persisting info.

@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 Aug 20, 2022
@alexflorisca alexflorisca removed the status: stale Stale issues and PRs have had no updates for 60 days. label Sep 1, 2022
@alexflorisca alexflorisca reopened this Sep 1, 2022
@tarhi-saad tarhi-saad self-assigned this Nov 8, 2022
@alexflorisca
Copy link
Member

This hook combines data from the cart data store with WC settings data. I've seen this in a few places. What do you think about adding the wc/settings data to a (potentially read-only) store? It's global state, it's used throughout our blocks and components in various places and it would simplify data access throughout. The only downside I see is that there may be a delay while the store is initialised with the data, therefore delaying anything that needs immediate access to it. I think this would be minimal but I don't know the codebase well enough to say wether this would be a real problem or not? @senadir @opr thoughts?

@alexflorisca
Copy link
Member

Decided not to do this for now (p1668615895631919-slack-C8X6Q7XQU) closing.

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. type: refactor The issue/PR is related to refactoring. type: technical debt This issue/PR represents/solves the technical debt of the project.
Projects
None yet
Development

No branches or pull requests

4 participants