-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Checkout: Convert useCreateExistingCards to TypeScript #50723
Conversation
They are already optional
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~13 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~6 bytes removed 📉 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
import { useRef, useEffect } from 'react'; | ||
|
||
// See https://usehooks.com/useMemoCompare/ | ||
export default function useMemoCompare< A, B >( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems general purpose enough to warrant being put in a less specific place, but I'm not sure where that would be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, same. There's a few things in this directory and lib
that fall into a general utility category but I figure we can always move them later.
Looks good and works as expected. |
The only relevant failing e2e test seems to be that the G Suite upgrade card (see #48516) is redirecting back to the domains page when clicking "Skip for now". This could be an actual bug, but I don't think it's related to this PR so I'm going to research it separately. I'm adding a notice to that redirect in #50738 to help track it down. |
Changes proposed in this Pull Request
Eventually it would be nice to convert all of
useCreatePaymentMethods
to TypeScript, but it's a lot of code. This takes the first step by moving the hook to its own directory and then converting one of its sub-functions,useCreateExistingCards
. That function also happens to be used independently by the payment management pages.Testing instructions
Two areas are affected by this change: checkout (for saved cards) and the "change payment method" pages (both site-level and account-level, although they use the same component so only one needs to be tested).
To test checkout:
To test payment method changes: