From 86ca21b6fa249ec7de73d7f9da3f551418cafdc7 Mon Sep 17 00:00:00 2001 From: Vedant Navale <129394506+AgeCoder@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:49:13 +0530 Subject: [PATCH] fix: create default space when skipping (#150) --- .../stages/initial-space/create.tsx | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/renderer/src/components/onboarding/stages/initial-space/create.tsx b/src/renderer/src/components/onboarding/stages/initial-space/create.tsx index ab44b031..3b68fefd 100644 --- a/src/renderer/src/components/onboarding/stages/initial-space/create.tsx +++ b/src/renderer/src/components/onboarding/stages/initial-space/create.tsx @@ -58,20 +58,23 @@ export function OnboardingCreateSpace({ }, []); // Create the space in the main profile - const createSpace = async () => { + const createSpace = async (name?: string) => { if (!mainProfile || isCreating || createSuccess) return; setIsCreating(true); setErrorMessage(null); try { + // Use the provided name or the current spaceName + const spaceToCreate = name || spaceName; + // Create the space with just the name - const created = await flow.spaces.createSpace(mainProfile.id, spaceName); + const created = await flow.spaces.createSpace(mainProfile.id, spaceToCreate); if (created) { // Get all spaces to find the one we just created const spaces = await flow.spaces.getSpacesFromProfile(mainProfile.id); - const newSpace = spaces.find((s) => s.name === spaceName); + const newSpace = spaces.find((s) => s.name === spaceToCreate); if (newSpace) { // Save the space ID for the next steps @@ -96,6 +99,17 @@ export function OnboardingCreateSpace({ } }; + // Handle skip action + const handleSkip = async () => { + if (mainProfile && !hasSpaces) { + // If we have a main profile but no spaces, create a default one + await createSpace(DEFAULT_SPACE_NAME); + } else { + // Otherwise just advance + advance(); + } + }; + return ( <> Something went wrong
{errorMessage}