Skip to content

Commit 16b2b23

Browse files
committed
fix: show error state on name field instead of toast when empty
1 parent 651b94f commit 16b2b23

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/browser/components/ChatInput/useCreationWorkspace.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,9 @@ export function useCreationWorkspace({
152152

153153
try {
154154
// Wait for name generation to complete (blocks if still in progress)
155+
// Returns empty string if generation failed or manual name is empty (error already set in hook)
155156
const workspaceName = await waitForGeneration();
156157
if (!workspaceName) {
157-
setToast({
158-
id: Date.now().toString(),
159-
type: "error",
160-
message: "Failed to generate workspace name. Please enter a name manually.",
161-
});
162158
setIsSending(false);
163159
return false;
164160
}

src/browser/hooks/useWorkspaceName.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,12 @@ export function useWorkspaceName(options: UseWorkspaceNameOptions): UseWorkspace
166166
}, []);
167167

168168
const waitForGeneration = useCallback(async (): Promise<string> => {
169-
// If auto-generate is off, return the manual name
169+
// If auto-generate is off, return the manual name (or set error if empty)
170170
if (!autoGenerate) {
171+
if (!manualName.trim()) {
172+
setError("Please enter a workspace name");
173+
return "";
174+
}
171175
return manualName;
172176
}
173177

0 commit comments

Comments
 (0)