@@ -295,19 +295,22 @@ function useBrowsePathInput(environment: EnvironmentOption | null, pinnedDirecto
295295 const environmentId = environment ?. environmentId ?? null ;
296296 const environmentBaseDirectory = environment ?. baseDirectory ?? null ;
297297 const clonePathCaseSensitive = ! isWindowsPlatform ( environment ?. platform ?? "" ) ;
298- const [ pathInput , commitPathInput ] = useState ( ( ) =>
299- getCloneDestinationPath (
298+ const [ destination , setDestination ] = useState ( ( ) => ( {
299+ path : getCloneDestinationPath (
300300 getAddProjectInitialQuery ( environmentBaseDirectory ) ,
301301 pinnedDirectoryName ,
302302 ) ,
303- ) ;
303+ explicit : false ,
304+ } ) ) ;
304305 const previousEnvironmentIdRef = useRef ( environmentId ) ;
305306 const environmentRuntime = useRemoteEnvironmentRuntime ( environmentId ) ;
306307 const loadBrowsePath = useAtomQueryRunner ( filesystemEnvironment . browse , {
307308 reportFailure : false ,
308309 reportDefect : false ,
309310 } ) ;
310- const [ pathOwner ] = useState ( ( ) => createDestinationPathOwner ( commitPathInput ) ) ;
311+ const [ pathOwner ] = useState ( ( ) =>
312+ createDestinationPathOwner ( ( path , explicit ) => setDestination ( { path, explicit } ) ) ,
313+ ) ;
311314 const [ isBrowseNavigating , setIsBrowseNavigating ] = useState ( false ) ;
312315 const setPathInput = ( path : string ) => {
313316 setIsBrowseNavigating ( false ) ;
@@ -365,7 +368,8 @@ function useBrowsePathInput(environment: EnvironmentOption | null, pinnedDirecto
365368
366369 return {
367370 isBrowseNavigating,
368- pathInput,
371+ pathInput : destination . path ,
372+ pathIsExplicit : destination . explicit ,
369373 setPathInput,
370374 navigateToBrowsePath,
371375 suggestPath : pathOwner . suggest ,
@@ -1296,8 +1300,14 @@ export function AddProjectDestinationScreen(props: {
12961300 const repositoryTitle = stringParam ( props . repositoryTitle ) ;
12971301 const prompt = stringParam ( props . prompt ) ;
12981302 const repositoryName = stringParam ( props . repositoryName ) ?. trim ( ) ?? "" ;
1299- const { isBrowseNavigating, navigateToBrowsePath, pathInput, setPathInput, suggestPath } =
1300- useBrowsePathInput ( environment , repositoryName ) ;
1303+ const {
1304+ isBrowseNavigating,
1305+ navigateToBrowsePath,
1306+ pathInput,
1307+ pathIsExplicit,
1308+ setPathInput,
1309+ suggestPath,
1310+ } = useBrowsePathInput ( environment , repositoryName ) ;
13011311 const suggestedDestination = useEnvironmentQuery (
13021312 environment ?. ghqCloneLayout && remoteUrl
13031313 ? sourceControlEnvironment . suggestCloneDestination ( {
@@ -1311,6 +1321,7 @@ export function AddProjectDestinationScreen(props: {
13111321 useEffect ( ( ) => {
13121322 if ( suggestion ?. destinationPath ) suggestPath ( suggestion . destinationPath ) ;
13131323 } , [ suggestPath , suggestion ] ) ;
1324+ const awaitingSuggestion = suggestedDestination . isPending && ! pathIsExplicit ;
13141325 const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
13151326 const [ error , setError ] = useState < string | null > ( null ) ;
13161327
@@ -1321,7 +1332,7 @@ export function AddProjectDestinationScreen(props: {
13211332 ! readEnvironmentScope ( environment . environmentId , AuthOrchestrationOperateScope ) ||
13221333 ! remoteUrl ||
13231334 isBrowseNavigating ||
1324- suggestedDestination . isPending ||
1335+ awaitingSuggestion ||
13251336 isSubmitting
13261337 ) {
13271338 return ;
@@ -1418,7 +1429,7 @@ export function AddProjectDestinationScreen(props: {
14181429 disabled = {
14191430 ! canCloneProject ||
14201431 isBrowseNavigating ||
1421- suggestedDestination . isPending ||
1432+ awaitingSuggestion ||
14221433 isSubmitting ||
14231434 ! remoteUrl
14241435 }
0 commit comments