Archived
Add paged chat history loading
This commit is contained in:
@@ -14,15 +14,18 @@ export class WorkspaceService {
|
||||
const worktrees = await discoverGitWorktrees(project.path);
|
||||
if (worktrees.length === 0) return [this.single(project)];
|
||||
|
||||
return worktrees.map((worktree) => ({
|
||||
id: idFor(`${project.id}:${worktree.path}`),
|
||||
projectId: project.id,
|
||||
path: worktree.path,
|
||||
label: worktree.branch || (worktree.detached ? "detached" : worktree.path.split("/").filter(Boolean).at(-1) || worktree.path),
|
||||
branch: worktree.branch,
|
||||
isMain: worktree.path === project.path,
|
||||
isGitWorktree: true,
|
||||
}));
|
||||
return worktrees.map((worktree) => {
|
||||
const leafName = worktree.path.split("/").filter((part) => part !== "").at(-1);
|
||||
return {
|
||||
id: idFor(`${project.id}:${worktree.path}`),
|
||||
projectId: project.id,
|
||||
path: worktree.path,
|
||||
label: worktree.branch ?? (worktree.detached === true ? "detached" : leafName ?? worktree.path),
|
||||
...(worktree.branch === undefined ? {} : { branch: worktree.branch }),
|
||||
isMain: worktree.path === project.path,
|
||||
isGitWorktree: true,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private single(project: Project): Workspace {
|
||||
|
||||
Reference in New Issue
Block a user