Skip to content

Conversation

@sejas
Copy link
Member

@sejas sejas commented Dec 10, 2025

Related issues

Proposed Changes

  • This PR is a refactor; it does not add new functionality or fix any issues.
  • It refactors how we reset the Add Site form after closing the modal or creating a site.
  • Removes the unnecessary localAddSiteProps variable.
  • Clean sites and loadingSites from useAddSite. These values should be consumed directly from useSiteDetails.
  • It doesn't reset the form in NoStudioSites because that component will reset its state when it gets unmounted.

Testing Instructions

  • Run npm start
  • Click on Add site
  • Try each option
  • Confirm there are no regressions and that the creation of one site doesn't affect another. For example, after pulling an existing site, creating a blank site should result in just a blank site being created.
  • Repeat the testing but this time remove all your local sites to try the site creation without the modal.
  • Try to open blueprint deeplinks, e.g.:
wp-studio://add-site?blueprint=eyJtZXRhIjp7InRpdGxlIjoiVGhpcyBpcyBhIHRlc3QgYmx1ZXByaW50IiwiZGVzY3JpcHRpb24iOiJJdCBpbnN0YWxscyBBc3RyYSB0aGVtZSBhbmQgWW9hc3QgU0VPIHBsdWdpbiIsImF1dGhvciI6Iml2YW4iLCJjYXRlZ29yaWVzIjpbInJzcyIsInNvY2lhbCB3ZWIiXX0sInByZWZlcnJlZFZlcnNpb25zIjp7InBocCI6IjguMyIsIndwIjoibGF0ZXN0In0sInN0ZXBzIjpbeyJzdGVwIjoiaW5zdGFsbFRoZW1lIiwidGhlbWVEYXRhIjp7InJlc291cmNlIjoid29yZHByZXNzLm9yZy90aGVtZXMiLCJzbHVnIjoiYXN0cmEifSwib3B0aW9ucyI6eyJhY3RpdmF0ZSI6dHJ1ZX19LHsic3RlcCI6Imluc3RhbGxQbHVnaW4iLCJwbHVnaW5EYXRhIjp7InJlc291cmNlIjoid29yZHByZXNzLm9yZy9wbHVnaW5zIiwic2x1ZyI6IndvcmRwcmVzcy1zZW8ifSwib3B0aW9ucyI6eyJhY3RpdmF0ZSI6dHJ1ZX19LHsic3RlcCI6ImxvZ2luIiwidXNlcm5hbWUiOiJhZG1pbiIsInBhc3N3b3JkIjoicGFzc3dvcmQifV19 

or the ones in https://jsbin.com/levaburate/2/edit?html,css,output .

  1. Confirm there are no unexpected behavior, and all sites should be created correctly.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@sejas sejas self-assigned this Dec 10, 2025
@sejas sejas requested a review from a team December 10, 2025 13:12
@sejas sejas changed the title Update/refactor use add site reset form Refactor useAddSite reset form and simplifies the logic Dec 10, 2025
Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

Nice clean-up, Antonio! 54 more lines gone! 👍🏼

The changes look good and I did not observe any regressions (tested all options with existing local sites and with no sites as well). The form gets cleared correctly. The blueprint deeplinks still work as before. 👌🏼

@github-actions
Copy link
Contributor

📊 Performance Test Results

Comparing 3d8ea42 vs trunk

site-editor

Metric trunk 3d8ea42 Diff Change
load 26137.00 ms 19625.00 ms -6512.00 ms 🟢 -24.9%

site-startup

Metric trunk 3d8ea42 Diff Change
siteCreation 42209.00 ms 23893.00 ms -18316.00 ms 🟢 -43.4%
siteStartup 14268.00 ms 14213.00 ms -55.00 ms 🟢 -0.4%

Results are median values from multiple test runs.

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

Copy link
Contributor

@katinthehatsite katinthehatsite left a comment

Choose a reason for hiding this comment

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

This seems to work as expected for me 👍 I did not spot any further regressions

@sejas sejas merged commit 3063266 into trunk Dec 10, 2025
12 of 13 checks passed
@sejas sejas deleted the update/refactor-use-add-site-reset-form branch December 10, 2025 15:00
@sejas sejas changed the title Refactor useAddSite reset form and simplifies the logic Refactor useAddSite reset form and simplify the state Dec 10, 2025
@sejas sejas mentioned this pull request Dec 12, 2025
1 task
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