fix(projects): make freshly-added projects editable

Make workspace-less projects flow through aggregated project fetching and keep the settings screen editable immediately after adding one.
This commit is contained in:
huiliaoning
2026-06-27 12:44:16 +08:00
committed by GitHub
parent a908384e5a
commit 26a8a04651
10 changed files with 1531 additions and 22 deletions
@@ -169,7 +169,7 @@ export function useSidebarWorkspacesList(options?: {
void (async () => {
const next = new Map<string, WorkspaceDescriptor>();
try {
const workspaces = await fetchAllWorkspaceDescriptors({
const { workspaces, emptyProjects } = await fetchAllWorkspaceDescriptors({
client,
sort: [{ key: "activity_at", direction: "desc" }],
});
@@ -181,6 +181,9 @@ export function useSidebarWorkspacesList(options?: {
}
const store = useSessionStore.getState();
store.setWorkspaces(serverId, next);
// Keep parents with no workspaces yet, so a manual refresh doesn't drop
// a freshly-added project from the sidebar.
store.setEmptyProjects(serverId, emptyProjects);
store.setHasHydratedWorkspaces(serverId, true);
} catch (error) {
console.error("[WorkspaceFetch][sidebar-refresh] failed", {