-
Notifications
You must be signed in to change notification settings - Fork 54
Avoid showing a path conflict when pulling a remote site multiple times #2239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid showing a path conflict when pulling a remote site multiple times #2239
Conversation
epeicher
left a comment
There was a problem hiding this 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 |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| <PullRemoteSite | ||
| selectedRemoteSite={ selectedRemoteSite } | ||
| setSelectedRemoteSite={ ( remoteSite?: SyncSite ) => { | ||
| setSelectedRemoteSite={ async ( remoteSite?: SyncSite ) => { |
There was a problem hiding this comment.
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
src/modules/add-site/index.tsx
Outdated
| const handlePullRemoteContinue = useCallback( async () => { | ||
| if ( selectedRemoteSite ) { | ||
| const availableName = await findAvailableSiteName( selectedRemoteSite.name ); | ||
| void createSiteProps.handleSiteNameChange( availableName ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it here 141c3f2
📊 Performance Test ResultsComparing 936222c vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
katinthehatsite
left a comment
There was a problem hiding this 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 👍




Related issues
Proposed Changes
Testing Instructions
npm startpull-site-twice.mp4
Pre-merge Checklist