-
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
Billing: Remove unused code not behind new payment methods flag #48494
Billing: Remove unused code not behind new payment methods flag #48494
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~443 bytes removed 📉 [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 (~49 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. |
b398036
to
2ac998b
Compare
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.
Everything appears to work correctly. I have some questions about the code but overall I think this is great!
|
||
// redirect legacy urls | ||
router( '/me/billing', () => page.redirect( paths.billingHistory ) ); | ||
router( '/me/billing/:receiptId', ( { params: { receiptId } } ) => | ||
page.redirect( paths.billingHistoryReceipt( receiptId ) ) | ||
); | ||
router( paths.addCardDetails( ':site', ':purchaseId' ), ( { params: { site, purchaseId } } ) => |
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.
🤔 Since it appears these routes were effectively removed by the flag until now, maybe they're not necessary and/or are covered by something else? Let's check.
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.
It's also possible that they are necessary, but were disabled accidentally as a result of our flag and we need to make sure that the legacy routes remain as you've done here; I just wanted to be sure that was the case.
client/me/purchases/manage-purchase/change-payment-method/index.jsx
Outdated
Show resolved
Hide resolved
@@ -46,6 +46,7 @@ export function confirmCancelDomain( siteName, purchaseId ) { | |||
return managePurchase( siteName, purchaseId ) + '/confirm-cancel-domain'; | |||
} | |||
|
|||
// legacy path |
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.
Are these still necessary? Can we replace their remaining uses with the new paths?
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.
I need to make sure I understand the suggestion. If we remove these completely, any old links to (for instance) /payment/add
will break, right?
`/purchases/subscriptions/${ siteName }/${ purchaseId }/payment-method/change/${ cardId }` | ||
) | ||
); | ||
router( |
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.
Similar to my above comment: I'm surprised that we had legacy routes here that have been disabled since the flag was introduced... are we sure they aren't covered elsewhere?
I removed some of these in #49897 as a side-effect of the clean-up there. |
2ac998b
to
172d6b6
Compare
36e6565
to
92d9eb0
Compare
Rebased again |
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 looks fine to me. If there's any more clean-up or further discussion to be had, we can do it in another PR.
Changes proposed in this Pull Request
purchases/new-payment-methods
flag, we can clean up this code that's only active when the flag is not set.Testing instructions
This PR should only be removing code that is inactive due to the
purchases/new-payment-methods
flag being permanently set in all deployment environments.We should also make sure the old urls redirect correctly.
/me/purchases/:site/:purchaseId/payment/add
to/me/purchases/:site/:purchaseId/payment-method/add
/me/purchases/add-credit-card
to/me/purchases/add-payment-method
/me/purchases/:site/:purchaseId/payment/change/:cardId
to/me/purchases/:site/:purchaseId/payment-method/change/:cardId
Legacy URLs (not sure if these are used anywhere; it might be worth figuring that out so these can be removed):
/purchases/:siteName/:purchaseId/payment/add
to/purchases/subscriptions/:siteName/:purchaseId/payment-method/add
/purchases/:siteName/:purchaseId/payment/edit/:cardId
to/purchases/subscriptions/:siteName/:purchaseId/payment-method/change/:cardId
/purchases/subscriptions/:site/:purchaseId/payment/add
to/purchases/subscriptions/:site/:purchaseId/payment-method/add
/purchases/subscriptions/:site/:purchaseId/payment/edit/:cardId
to/purchases/subscriptions/:site/:purchaseId/payment-method/change/:cardId
/purchases/add-credit-card/:site
to/purchases/add-payment-method/:site