Skip to content

Commit cf8bcb6

Browse files
committed
fix(add-repository): make local repository dialog submission reliable
Tighten the Add Local Repository dialog so choosing a valid repository path and immediately pressing Add consistently runs the add flow instead of silently stalling in the dialog. Changes: - resolve the entered local path before submit-time validation so `validatePath(...)` uses the same normalized path handling as the live `onPathChanged(...)` validation path - wait for the folder-picker path to finish landing in component state before allowing the chosen path to be used for submission - keep the rest of the add-existing-repository flow unchanged so successful submissions still dismiss the dialog, add the repository, and select it Behavioral effect: The Add Local Repository dialog no longer ends up in a no-op state where a repository path appears valid in the picker flow but submit-time validation never reaches `_addRepositories(...)`. Choosing a worktree path from the folder picker and immediately pressing Add now reliably adds the repository. Testing: - yarn eslint app/src/ui/add-repository/add-existing-repository.tsx - yarn compile:prod
1 parent 7aae8cf commit cf8bcb6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/src/ui/add-repository/add-existing-repository.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export class AddExistingRepository extends React.Component<
7777
}
7878

7979
private async updatePath(path: string) {
80-
this.setState({ path })
80+
await new Promise<void>(resolve => {
81+
this.setState({ path }, resolve)
82+
})
8183
}
8284

8385
private async validatePath(path: string): Promise<boolean> {
@@ -89,7 +91,8 @@ export class AddExistingRepository extends React.Component<
8991
return false
9092
}
9193

92-
const type = await getRepositoryType(path)
94+
const resolvedPath = this.resolvedPath(path)
95+
const type = await getRepositoryType(resolvedPath)
9396

9497
const isRepository = type.kind !== 'missing' && type.kind !== 'unsafe'
9598
const isRepositoryUnsafe = type.kind === 'unsafe'

0 commit comments

Comments
 (0)