Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/start/src/components/project-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ export default function ProjectSelector({
))}
<DropdownMenuSeparator />
<DropdownMenuItem asChild>
<Link to={'/onboarding/project'}>
<Link
search={{ createNewOrg: true }}
to={'/onboarding/project'}
>
New organization
<DropdownMenuShortcut>
<PlusIcon size={16} />
Expand Down
8 changes: 7 additions & 1 deletion apps/start/src/routes/_steps.onboarding.project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import { cn } from '@/utils/cn';

const validateSearch = z.object({
inviteId: z.string().optional(),
createNewOrg: z
.preprocess((value) => value === true || value === 'true', z.boolean())
.optional(),
});
export const Route = createFileRoute('/_steps/onboarding/project')({
component: Component,
Expand Down Expand Up @@ -63,6 +66,7 @@ export const Route = createFileRoute('/_steps/onboarding/project')({
type IForm = z.infer<typeof zOnboardingProject>;

function Component() {
const search = Route.useSearch();
const trpc = useTRPC();
const queryClient = useQueryClient();
const { data: organizations } = useQuery(
Expand Down Expand Up @@ -121,7 +125,9 @@ function Component() {
});

const [showCorsInput, setShowCorsInput] = useState(false);
const [createNewOrg, setCreateNewOrg] = useState(false);
const [createNewOrg, setCreateNewOrg] = useState(
() => search.createNewOrg ?? false
);
const canUseExistingWorkspace = organizations.length > 0;
const showCreateForm = createNewOrg || organizations.length === 0;

Expand Down