-
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: remove post-checkout polling for site for create_new_blog #69837
Checkout: remove post-checkout polling for site for create_new_blog #69837
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 (~414 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. |
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.
Tested regular site creation, new user siteless domain creation, and gifted domain (which had been failing previously). All checkouts as expected.
Code looks good, though I wonder if we shouldn't keep getDomainNameFromReceiptOrCart
.
The function is totally fine but it's not used anywhere. 🤷 I'm inclined to remove it and if folks need it again it can be re-added. I'll update the PR description to mention the removal to it's easier to find. |
…69837) * Clarify post-checkout new site polling conditions * Remove call to fetchSitesAndUser in post-checkout * Remove unused getDomainNameFromReceiptOrCart
Background
The transactions endpoint supports a property on the shopping cart object called
create_new_blog
. If set, the endpoint will create a new site before the transaction is processed. However, even though we set this property on the frontend for any transaction where there is no currently selected site (which should be domain-only checkout and Jetpack siteless checkout, although the latter may have a special case), it doesn't appear to be ever used on the backend to create a new site (see https://github.com/Automattic/payments-shilling/issues/759#issuecomment-1306365375). This is because logged-out and siteless flows that currently go through checkout (except for Jetpack siteless checkout which understandably does not need to create a site) create the site before the transaction is submitted.While it may not yet be safe to remove the
create_new_blog
property entirely (since it may be used on the backend cart to signal that a site will be created), we can probably remove some of the machinery that uses it.Proposed Changes
In this PR we remove code that causes some post-checkout flows (for non-redirect payment methods which have
create_new_blog
and a domain in the purchase) to poll the sites endpoint after the transactions endpoint returns a successful response. This code was probably intended to prevent issues where the post-checkout page would try to display information about the newly created site and fail, but I think this is unlikely ever to happen since post-checkout for new sites already causes a hard-redirect which will probably reload the sites list.The code removed by this PR was added in #42723 which in turn imported the behavior from the old version of checkout where it was added originally in #10936. That PR was creating a flow for domain-only checkout which should not be affected by this change (although I think that flow does create a hidden site in the background so it's wise to make sure that PR's test instructions still work).
Fixes #69833 where purchasing a gift subscription for another site would cause infinite polling to occur.
Note: this also removes the
getDomainNameFromReceiptOrCart()
function which is no longer used anywhere.Testing Instructions
First we can follow the test instructions for the PR that added this code to the rebuilt checkout:
Second we can follow the instructions for the PR that originally added the code to make sure that domain-only checkout is unaffected:
/start/domain/domain-only
and complete the flow to purchase a new domain without a site.