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

[dev]: Refactor Checkout #1309

Merged
merged 33 commits into from
Jun 27, 2019
Merged

[dev]: Refactor Checkout #1309

merged 33 commits into from
Jun 27, 2019

Conversation

sirugh
Copy link
Contributor

@sirugh sirugh commented Jun 6, 2019

Description

Refactoring of checkout components, including updating unit tests. Notably:

  • Removed SubmitButton in favor of just using the Button component directly.
  • Removed the unused ResetButton.
  • Address Form Refactor
    • fixed bug in checkout reducer where street address was not saved
  • BraintreeDropin Refactor
    • The conversion to the mount/unmount logic required some...interesting code. Check out the useEffect in the component and see how I had to use a local variable to ensure we teardown/error properly.
  • Payment Form Refactor
    • identified a "bug" where informed updates state if initialValues are used causing multiple renders.
  • Form Refactor
    • The parent form is now split into multiple function components. Should we move these into a Form/ directory and split them out into individual files?

Related Issue

Closes #1294.

Verification Steps

  1. Go to the checkout form and step through it. Everything should work including all validation, etc.
  2. Try doing the checkout form out of order.
  3. Try quickly opening and closing sub-forms such as the payments form.
  4. Make sure form state is used appropriately. Does it remember address? Does it remember last choices such as "use same as shipping address", etc?

How have YOU tested this?

Lots of manual testing through different scenarios. See above.

Screenshots / Screen Captures (if appropriate):

Proposed Labels for Change Type/Package

  • major (e.g x.0.0 - a breaking change)
  • minor (e.g 0.x.0 - a backwards compatible addition)
  • patch (e.g 0.0.x - a bug fix)

Checklist:

  • I have updated the documentation accordingly, if necessary.
  • I have added tests to cover my changes, if necessary.

@sirugh sirugh self-assigned this Jun 6, 2019
@vercel
Copy link

vercel bot commented Jun 6, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://venia-git-refactor-checkout.magento-research1.now.sh

submit,
submitting
} = props;
const formState = useFormState();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A wild hook appears!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good comment. I'm not surprised, though; Informed implements change publishing manually, so they're not doing hooks + context in any sort of optimal way.

@sirugh sirugh added version: Major This changeset includes incompatible API changes and its release necessitates a Major version bump. and removed in progress labels Jun 10, 2019
@sirugh sirugh requested review from jimbo, supernova-at and tjwiebell and removed request for jimbo June 11, 2019 13:18
}
const isSubmitDisabled = (busy, valid) => busy || !valid;

const EditableForm = props => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parent form is now split into multiple function components. Should we move these into a Form/ directory and split them out into individual files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimbo says he prefers flat structure. I like nested, for things that are specific to a parent and won't be shared. 🤷‍♂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parent form is now split into multiple function components. Should we move these into a Form/ directory and split them out into individual files?

We should definitely split them out into individual files, as per existing convention. I do like the idea of a Form/ directory personally - especially since we have a Receipt directory within Checkout already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimbo says he prefers flat structure. I like nested, for things that are specific to a parent and won't be shared. 🤷‍♂

fight

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never have had a Receipt folder either—last year we had a few contributors who didn't like to follow conventions. 😉

Honestly though, if you guys prefer to nest folders in places with a lot of files like this, I'm fine with it. Just don't go overboard.

Copy link
Contributor

@jimbo jimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sirugh Looks good. A couple remaining small items if you'd like, but this is basically ready. 👍

@sirugh sirugh self-assigned this Jun 25, 2019
@sirugh
Copy link
Contributor Author

sirugh commented Jun 25, 2019

@jimbo feedback addressed! If this is good to go please put it in Ready for QA :)

@dpatil-magento dpatil-magento merged commit c3228b4 into develop Jun 27, 2019
@sirugh sirugh mentioned this pull request Jul 8, 2019
6 tasks
@sirugh sirugh deleted the refactor/checkout branch July 25, 2019 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:venia-concept version: Major This changeset includes incompatible API changes and its release necessitates a Major version bump.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Peregrine: Checkout
5 participants