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

Uses TLD to check for subdomain status for Mapping #98864

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

StevenPartridge
Copy link
Contributor

@StevenPartridge StevenPartridge commented Jan 24, 2025

rather than a hardcoded list of TLDs on the Front End

relies on wpcom diff: 170938-ghe-Automattic/wpcom

Related to # https://github.com/Automattic/nomado-issues/issues/947

Proposed Changes

  • Uses the already called 'domain-mapping-info' API call, and a new key added to that, to get the TLD from the backend (Single Source of Truth), instead of relying purely on a simple check on the front end (incomplete second source of truth).
  • Introduces optional parameter, 'tld' to the isSubdomain function
  • If 'tld' is provided and validated, uses that TLD or SLD to safely check if the domain is using an SLD or just a subdomain
  • Leaves the original functionality to ensure nothing breaks unexpectedly, but it would be good to get the TLD from the backend in all cases where isSubdomain is used, to keep it as Single Source of Truth

Why are these changes being made?

  • When users connect domains, we suggest some guidance based on whether it's a Subdomain or a full Domain (possibly with multi-level TLD). Users have expressed confusion and reached out to HEs for assistance when provided the wrong guidance
  • The current check only looks at a list of hard-coded SLDs in the front-end (which is technically how the backend works, but that should be the source of truth as it's MASSIVELY more complete)
  • Instead of adding a few SLDs to that list at a time (won't solve everything), or adding the entire list (too big), Kamen suggested this exact approach on Slack
    • p1736980903062009-slack-C0BNMNMNG

Testing Instructions

  • Load this branch and proxy Sandbox with 170938-ghe-Automattic/wpcom
  • Open the network tab, using the filter mapping-setup-info to isolate the single API call
  • You can skip actually mapping a thing and go straight to the correct Step
  • Load up /domains/mapping/YOURSITE.tld/setup/notsubdomain.ca?firstVisit=true Replace YOURISTE.tld with a test site
  • Test with a series of domains, subdomains, and two level TLDs, deeply nested subdomains, etc.

With fix (assnat.qc.ca localhost):
image

Without fix (assnat.qc.ca on wordpress.com):
image

@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~334 bytes added 📈 [gzipped])

name                  parsed_size           gzip_size
update-design-flow         +370 B  (+0.0%)     +119 B  (+0.0%)
link-in-bio-tld-flow       +370 B  (+0.0%)     +119 B  (+0.0%)
domains                    +370 B  (+0.0%)     +116 B  (+0.0%)
copy-site-flow             +370 B  (+0.0%)     +119 B  (+0.0%)
hosting                    +327 B  (+0.0%)     +105 B  (+0.0%)
plans                      +318 B  (+0.0%)     +101 B  (+0.0%)

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 (~229 bytes added 📈 [gzipped])

name                                                      parsed_size           gzip_size
async-load-signup-steps-domains                                +370 B  (+0.1%)     +119 B  (+0.1%)
async-load-calypso-my-sites-current-site-domain-warnings       +318 B  (+1.0%)     +110 B  (+1.5%)

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.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@StevenPartridge StevenPartridge requested a review from a team January 24, 2025 01:39
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 24, 2025
@StevenPartridge StevenPartridge self-assigned this Jan 24, 2025
@StevenPartridge StevenPartridge marked this pull request as ready for review January 24, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants