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
4 changes: 3 additions & 1 deletion app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export default function NotFound() {
</p>
<div className="mt-6">
<Link
href={`${protocol}://${rootDomain}`}
href={`${protocol}://${rootDomain}?subdomain=${encodeURIComponent(
subdomain ?? ''
)}`}
className="rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700"
>
{subdomain ? `Create ${subdomain}` : `Go to ${rootDomain}`}
Expand Down
6 changes: 5 additions & 1 deletion app/subdomain-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from '@/components/ui/emoji-picker';
import { createSubdomainAction } from '@/app/actions';
import { rootDomain } from '@/lib/utils';
import { useSearchParams } from 'next/navigation';

type CreateState = {
error?: string;
Expand Down Expand Up @@ -132,9 +133,12 @@ export function SubdomainForm() {
{}
);

const searchParams = useSearchParams();
const subdomain = state?.subdomain ?? searchParams.get('subdomain') ?? '';

return (
<form action={action} className="space-y-4">
<SubdomainInput defaultValue={state?.subdomain} />
<SubdomainInput defaultValue={subdomain} />

<IconPicker icon={icon} setIcon={setIcon} defaultValue={state?.icon} />

Expand Down