Skip to content

Commit 8978f64

Browse files
committed
🤖 fix: reconnect New Workspace button
1 parent e74e229 commit 8978f64

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/App.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useEffect, useCallback, useRef } from "react";
1+
import { useEffect, useCallback, useRef } from "react";
22
import "./styles/globals.css";
33
import { useWorkspaceContext } from "./contexts/WorkspaceContext";
44
import { useProjectContext } from "./contexts/ProjectContext";
@@ -44,6 +44,9 @@ function AppInner() {
4444
renameWorkspace,
4545
selectedWorkspace,
4646
setSelectedWorkspace,
47+
pendingNewWorkspaceProject,
48+
beginWorkspaceCreation,
49+
clearPendingWorkspaceCreation,
4750
} = useWorkspaceContext();
4851
const {
4952
projects,
@@ -54,9 +57,6 @@ function AppInner() {
5457
addProject,
5558
} = useProjectContext();
5659

57-
// Track when we're in "new workspace creation" mode (show FirstMessageInput)
58-
const [pendingNewWorkspaceProject, setPendingNewWorkspaceProject] = useState<string | null>(null);
59-
6060
// Auto-collapse sidebar on mobile by default
6161
const isMobile = typeof window !== "undefined" && window.innerWidth <= 768;
6262
const [sidebarCollapsed, setSidebarCollapsed] = usePersistedState("sidebarCollapsed", isMobile);
@@ -72,7 +72,7 @@ function AppInner() {
7272

7373
const startWorkspaceCreation = useStartWorkspaceCreation({
7474
projects,
75-
setPendingNewWorkspaceProject,
75+
beginWorkspaceCreation,
7676
setSelectedWorkspace,
7777
});
7878

@@ -569,13 +569,13 @@ function AppInner() {
569569
telemetry.workspaceCreated(metadata.id);
570570

571571
// Clear pending state
572-
setPendingNewWorkspaceProject(null);
572+
clearPendingWorkspaceCreation();
573573
}}
574574
onCancel={
575575
pendingNewWorkspaceProject
576576
? () => {
577577
// User cancelled workspace creation - clear pending state
578-
setPendingNewWorkspaceProject(null);
578+
clearPendingWorkspaceCreation();
579579
}
580580
: undefined
581581
}

src/hooks/useStartWorkspaceCreation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function persistWorkspaceCreationPrefill(
8383

8484
interface UseStartWorkspaceCreationOptions {
8585
projects: Map<string, ProjectConfig>;
86-
setPendingNewWorkspaceProject: (projectPath: string | null) => void;
86+
beginWorkspaceCreation: (projectPath: string) => void;
8787
setSelectedWorkspace: (selection: WorkspaceSelection | null) => void;
8888
}
8989

@@ -100,7 +100,7 @@ function resolveProjectPath(
100100

101101
export function useStartWorkspaceCreation({
102102
projects,
103-
setPendingNewWorkspaceProject,
103+
beginWorkspaceCreation,
104104
setSelectedWorkspace,
105105
}: UseStartWorkspaceCreationOptions) {
106106
const startWorkspaceCreation = useCallback(
@@ -113,10 +113,10 @@ export function useStartWorkspaceCreation({
113113
}
114114

115115
persistWorkspaceCreationPrefill(resolvedProjectPath, detail);
116-
setPendingNewWorkspaceProject(resolvedProjectPath);
116+
beginWorkspaceCreation(resolvedProjectPath);
117117
setSelectedWorkspace(null);
118118
},
119-
[projects, setPendingNewWorkspaceProject, setSelectedWorkspace]
119+
[projects, beginWorkspaceCreation, setSelectedWorkspace]
120120
);
121121

122122
useEffect(() => {

0 commit comments

Comments
 (0)