Skip to content

Refactor blueprint deeplink handling in the Add site modal - #2216

Merged
ivan-ottinger merged 10 commits into
trunkfrom
add/add-site-context
Dec 10, 2025
Merged

Refactor blueprint deeplink handling in the Add site modal#2216
ivan-ottinger merged 10 commits into
trunkfrom
add/add-site-context

Conversation

@ivan-ottinger

@ivan-ottinger ivan-ottinger commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

The goal of this PR is to streamline the handling of blueprint deeplinks in the Add site modal and improve maintainability. We are getting rid of 34 lines of code.

  • remove AddSiteContentWithDeeplinkSupport component
  • move blueprint deeplink-related states to useAddSite

Testing Instructions

  1. Check out the PR branch and build the app with npm install && npm start.
  2. Since this PR does not add any new functionality, we can focus on finding regressions in the Add site modal. Actions you can try to perform (examples):
  • Remove all your local sites and try to create new sites using different options (e.g. blank new site, from local blueprint, import from backup, pull from WPCOM, ...).
  • Try the same as in the previous step, but now with at least one local site already created.
  • 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. There should be no unexpected behavior. All sites should be created correctly.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@ivan-ottinger ivan-ottinger changed the title Add/add site context Dec 8, 2025
@ivan-ottinger
ivan-ottinger force-pushed the add/add-site-context branch 2 times, most recently from 94d3f63 to d1688eb Compare December 9, 2025 11:58
@ivan-ottinger ivan-ottinger self-assigned this Dec 9, 2025
@ivan-ottinger ivan-ottinger changed the title Refactor: Add AddSiteProvider to handle states related to site creation modal Dec 10, 2025
@ivan-ottinger
ivan-ottinger marked this pull request as ready for review December 10, 2025 09:50
@ivan-ottinger
ivan-ottinger requested a review from a team December 10, 2025 09:51
@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Test Results

Comparing 007e9fc vs trunk

site-editor

Metric trunk 007e9fc Diff Change
load 13161.00 ms 13094.00 ms -67.00 ms 🟢 -0.5%

site-startup

Metric trunk 007e9fc Diff Change
siteCreation 27198.00 ms 26492.00 ms -706.00 ms 🟢 -2.6%
siteStartup 10062.00 ms 10068.00 ms +6.00 ms 🔴 0.1%

Results are median values from multiple test runs.

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

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for cleaning the code and removing AddSiteContentWithDeeplinkSupport, now the logic is much clearer.

I tested creating the 4 types of sites as first site and as second sites, and I didn't see any regression. The issue STU-1121 is still present, but we'll tackle that in a separate PR.

@ivan-ottinger
ivan-ottinger merged commit 3ead1a9 into trunk Dec 10, 2025
10 checks passed
@ivan-ottinger
ivan-ottinger deleted the add/add-site-context branch December 10, 2025 10:35

@gcsecsey gcsecsey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also tested this and found no regressions with either creating the sites or running the Blueprints via deeplinks.

Thank you for carrying out the refactor, Ivan! IMO this structure is much clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants