Skip to content

Conversation

leonardost
Copy link
Contributor

@leonardost leonardost commented Sep 3, 2025

Part of DOMAINS-1620

Proposed Changes

This PR:

  • Updates the Filter component used in domain search to fetch the available TLDs from the backend and
  • Adds the filter properties to the domain suggestions query, meaning the filter is now functional

Screenshot

Screenshot 2025-09-03 at 20 39 16

Demo

Screen.Recording.2025-09-04.at.19.44.41.mov

Why are these changes being made?

This is part of the Domain Search Rewrite project, which aims to rewrite domain search components in a provider-agnostic way.

Testing Instructions

  • Build this branch locally or open the live Calypso link
  • Go to /setup/onboarding/domains?flags=domain-search-rewrite
  • Ensure the filter has all TLDs that we offer in the list

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@leonardost leonardost self-assigned this Sep 3, 2025
Copy link

github-actions bot commented Sep 3, 2025

@leonardost leonardost force-pushed the update/add-available-tlds-query-to-domain-rewrite branch from d3de978 to 996daea Compare September 3, 2025 20:58
@leonardost leonardost force-pushed the update/add-available-tlds-query-to-domain-rewrite branch from 996daea to 3f8f7fd Compare September 3, 2025 21:00
@leonardost leonardost marked this pull request as ready for review September 3, 2025 23:38
Copy link
Contributor

@zaguiini zaguiini left a comment

Choose a reason for hiding this comment

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

Looking good so far!

  1. Can we disable the filter button while we're fetching the TLDs?
  2. Can we hide the filter button if there are no available TLDs?

@leonardost
Copy link
Contributor Author

Looking good so far!

  • Can we disable the filter button while we're fetching the TLDs?
  • Can we hide the filter button if there are no available TLDs?

@zaguiini yep! I've updated the PR with those.

@zaguiini
Copy link
Contributor

zaguiini commented Sep 4, 2025

Awesome @leonardost. The last step is to pass the tlds argument to the suggestion fetching query, as well as the exact SLD only param. Then we should be good to merge this.

@matticbot
Copy link
Contributor

matticbot commented Sep 4, 2025

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/add-available-tlds-query-to-domain-rewrite on your sandbox.

@leonardost
Copy link
Contributor Author

@zaguiini now the filter is being used in the domain suggestions query, let me know if it looks good to you 🙂

Copy link
Contributor

@zaguiini zaguiini left a comment

Choose a reason for hiding this comment

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

Awesome 🚀 🚀 🔥


const { data: suggestion } = useQuery( {
...queries.domainSuggestions( query ),
...queries.domainSuggestions( query, {
tlds: filter.tlds,
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if filter.tlds is an empty array? Can we only add it to the query if there's a value, and undefined otherwise?

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 qs library configuration we're using to generate query strings doesn't allow empty arrays to be sent as parameters, so it should be fine.

@leonardost leonardost merged commit 97f370e into trunk Sep 5, 2025
12 checks passed
@leonardost leonardost deleted the update/add-available-tlds-query-to-domain-rewrite branch September 5, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants