Skip to content

Conversation

@nightnei
Copy link
Contributor

@nightnei nightnei commented Nov 27, 2025

Proposed Changes

While working on Add wpcom to onboarding I noticed:

  1. We have a few unused properties, it seems they are from times when we had import process located inside the form for creating a site.
  2. Also after the previously mentioned PR we have 2 more unused properties now

So I decided to clean it up.

I was also thinking about moving create-site-form.tsx inside modules/add-site-form, and also merging it with modules/add-site/components/create-site, but to keep this PR easy for review, I decided that it's better not to do it right now.

I was also thinking about merging create-site and create-site-form, but to make this PR easier for review, I decided not to do it. It's not something very critical, but more important to make the PR diff clearer and easier for review.

Testing Instructions

  1. Run Studio
  2. Create a new site
  3. Assert that it was created and no errors in browser's console

@nightnei nightnei requested a review from a team November 27, 2025 16:38
@nightnei nightnei self-assigned this Nov 27, 2025
@nightnei nightnei requested a review from sejas November 27, 2025 16:45
Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

Yay! great catch. Thanks for cleaning the code.
I tested it by importing a new site.

importing-site.mp4

Let's also fix unit tests before merging.

@sejas sejas requested a review from Copilot November 27, 2025 17:54
Copilot finished reviewing on behalf of sejas November 27, 2025 17:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR cleans up the site creation form by removing legacy code related to the import process and renaming SiteForm to CreateSiteForm for better clarity. The cleanup removes unused properties and interfaces that were previously associated with importing backups during site creation.

Key changes:

  • Renamed SiteForm component to CreateSiteForm to better reflect its specific purpose
  • Removed legacy import-related functionality (FormImportComponent and associated props)
  • Cleaned up unused imports and properties (trash icon, useRef, ACCEPTED_IMPORT_FILE_TYPES, isDisabled parameter)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/modules/add-site/components/create-site.tsx Updated import and usage to reference CreateSiteForm instead of SiteForm
src/modules/add-site/components/create-site-form.tsx Renamed component from SiteForm to CreateSiteForm, removed legacy import functionality and unused props, cleaned up unused imports
Comments suppressed due to low confidence (2)

src/modules/add-site/components/create-site-form.tsx:37

  • The interface name SiteFormProps should be renamed to CreateSiteFormProps to match the component name CreateSiteForm. This follows the codebase convention where component names match their Props interface names (e.g., BlueprintIssuesModal uses BlueprintIssuesModalProps, Button uses ButtonProps).
    src/modules/add-site/components/create-site-form.tsx:61
  • [nitpick] The interface name SiteFormErrorProps and the component SiteFormError should be renamed to match the new component name (e.g., CreateSiteFormErrorProps and CreateSiteFormError) for consistency, since the parent component was renamed from SiteForm to CreateSiteForm.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

className?: string;
}

interface SiteFormProps {
Copy link
Member

Choose a reason for hiding this comment

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

Copilot made a great suggestions. We can rename the props name to match the renamed component.

Suggested change
interface SiteFormProps {
interface CreateSiteFormProps {

@fredrikekelund
Copy link
Contributor

This is just a suggestion, and it does increase the scope of this refactor, but this component deserves a refactor to reduce the props drilling even further, IMO.

The ideal scenario would be if CreateSiteForm received a features prop to determine which features to display in the form, and an onSubmit handler that receives an object with all the form values. It makes more sense for the state to live alongside the form controls than in the useAddSite hook, at the AddSite component level.

Base automatically changed from addWpComToOnboarding to trunk November 28, 2025 20:58
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

📊 Performance Test Results

Comparing ebd9fe4 vs trunk

site-editor

Metric trunk ebd9fe4 Diff Change
load 12468.00 ms 17227.00 ms +4759.00 ms 🔴 38.2%

site-startup

Metric trunk ebd9fe4 Diff Change
siteCreation 37057.00 ms 34982.00 ms -2075.00 ms 🟢 -5.6%
siteStartup 15151.00 ms 14131.00 ms -1020.00 ms 🟢 -6.7%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@nightnei
Copy link
Contributor Author

nightnei commented Dec 2, 2025

This is just a suggestion, and it does increase the scope of this refactor, but this component deserves a refactor to reduce the props drilling even further, IMO.
The ideal scenario would be if CreateSiteForm received a features prop to determine which features to display in the form, and an onSubmit handler that receives an object with all the form values. It makes more sense for the state to live alongside the form controls than in the useAddSite hook, at the AddSite component level.

Great idea, but let's do it later as a separate PR

@nightnei nightnei merged commit 107fbe4 into trunk Dec 2, 2025
9 checks passed
@nightnei nightnei deleted the cleanupSiteForm branch December 2, 2025 13:00
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.

4 participants