Show New Workspace isolation controls immediately (#2702)
* fix(workspaces): show isolation without checkout delay * fix(workspaces): trust hydrated project capability * fix(workspaces): resolve branch before creation * fix(workspaces): honor invalidated checkout status * fix(workspaces): preserve isolation while projects load * fix(workspaces): keep provisional project routes usable Route-derived projects do not know their worktree capability. Represent that uncertainty at the placement boundary so remembered worktree intent survives hydration without disabling the New Workspace screen indefinitely.
This commit is contained in:
@@ -35,14 +35,14 @@ export function hostProjectFromRoute(route: HostProjectRouteContext): HostProjec
|
||||
viewKey: createProjectViewKey({ kind: "placement", serverId: route.serverId, projectId }),
|
||||
projectKey: null,
|
||||
projectName: trimOptional(route.displayName) || projectId,
|
||||
projectKind: "git",
|
||||
projectKind: "unknown",
|
||||
iconWorkingDir,
|
||||
hosts: [
|
||||
{
|
||||
serverId: route.serverId,
|
||||
projectId,
|
||||
iconWorkingDir,
|
||||
canCreateWorktree: true,
|
||||
worktreeSupport: "unknown",
|
||||
},
|
||||
],
|
||||
workspaceKeys: [],
|
||||
@@ -80,7 +80,7 @@ export function hostProjectFromWorkspace(input: {
|
||||
serverId: input.serverId,
|
||||
projectId: input.workspace.projectId,
|
||||
iconWorkingDir,
|
||||
canCreateWorktree: canCreate,
|
||||
worktreeSupport: canCreate ? "supported" : "unsupported",
|
||||
},
|
||||
],
|
||||
workspaceKeys: [`${input.serverId}:${input.workspace.id}`],
|
||||
@@ -88,7 +88,7 @@ export function hostProjectFromWorkspace(input: {
|
||||
}
|
||||
|
||||
function projectCanCreateWorktree(project: HostProjectListItem): boolean {
|
||||
return project.hosts.some((h) => h.canCreateWorktree);
|
||||
return project.hosts.some((host) => host.worktreeSupport !== "unsupported");
|
||||
}
|
||||
|
||||
function getHostProjectPlacement(
|
||||
@@ -101,6 +101,13 @@ function getHostProjectPlacement(
|
||||
return null;
|
||||
}
|
||||
|
||||
export function getWorktreeSupportForHostProject(input: {
|
||||
project: HostProjectListItem;
|
||||
serverId: string;
|
||||
}): WorkspaceStructureHostPlacement["worktreeSupport"] {
|
||||
return getHostProjectPlacement(input.project, input.serverId)?.worktreeSupport ?? "unknown";
|
||||
}
|
||||
|
||||
export function getHostProjectSourceDirectory(
|
||||
project: HostProjectListItem,
|
||||
serverId: string,
|
||||
@@ -121,7 +128,7 @@ export function canCreateWorkspaceForHostProject(input: {
|
||||
if (!host) {
|
||||
return false;
|
||||
}
|
||||
return input.allowAllProjects || host.canCreateWorktree;
|
||||
return input.allowAllProjects || host.worktreeSupport !== "unsupported";
|
||||
}
|
||||
|
||||
export function filterWorkspaceProjectsForHost(input: {
|
||||
|
||||
Reference in New Issue
Block a user