Skip to content

Conversation

@sejas
Copy link
Member

@sejas sejas commented Dec 11, 2025

Related issues

Proposed Changes

  • When pulling an existing remote site multiple times, the user received an error conflicting in the path. In this PR I suggest appending a suffix number to generate a new clean path.

Testing Instructions

  • Run npm start
  • Click on Add site and then select Pull an existing site
  • Continue and create the site
  • Observe that the site name does not contain any numeric suffix.
  • Repeat the operation selecting the same site.
  • Observe that the generated name is "Sitename 2" so it doesn't show any error to the user.
Before After
Screenshot 2025-12-11 at 17 19 41 Screenshot 2025-12-11 at 17 21 30
pull-site-twice.mp4

Pre-merge Checklist

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

@sejas sejas self-assigned this Dec 11, 2025
@sejas sejas requested a review from a team December 11, 2025 17:24
Copy link
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

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

Thanks @sejas for solving this! I have had that issue in the past, and I thought that receiving an error was not a great UX, so I like this!

I have tested it, and it works as expected, I can see the sites with the number added and increasing. I have left a couple of minor comments, but this LGTM!

Existing site Selecting the same site Suffix added Suffix increased for subsequent sites
Image Image Image Image

<PullRemoteSite
selectedRemoteSite={ selectedRemoteSite }
setSelectedRemoteSite={ ( remoteSite?: SyncSite ) => {
setSelectedRemoteSite={ async ( remoteSite?: SyncSite ) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove the async keyword from here

const handlePullRemoteContinue = useCallback( async () => {
if ( selectedRemoteSite ) {
const availableName = await findAvailableSiteName( selectedRemoteSite.name );
void createSiteProps.handleSiteNameChange( availableName );
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we have moved this createSiteProps.handleSiteNameChange( availableName ) to an async function, maybe we can get rid of the void operator and replace it for an await? I think we should minimize the use of void to very specific use cases. But this is my personal opinion, happy to leave it as is, as it was the previous behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed it here 141c3f2

@github-actions
Copy link
Contributor

📊 Performance Test Results

Comparing 936222c vs trunk

site-editor

Metric trunk 936222c Diff Change
load 9732.00 ms 13976.00 ms +4244.00 ms 🔴 43.6%

site-startup

Metric trunk 936222c Diff Change
siteCreation 21606.00 ms 20423.00 ms -1183.00 ms 🟢 -5.5%
siteStartup 8991.00 ms 8986.00 ms -5.00 ms 🟢 -0.1%

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.

The changes look good to me, I am not seeing any regressions and the code reads well as well 👍

@sejas sejas merged commit edfb062 into trunk Dec 12, 2025
10 checks passed
@sejas sejas deleted the add/stu-1118-studio-avoid-showing-a-path-conflict-when-pulling-a-remote branch December 12, 2025 09:45
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