mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 12:55:06 +03:00
During a GitHub SSO signup (Personal Org, Free Plan, ~2025-03-30),
I encountered an error screen on the project creation page (`/new/[slug]`)
immediately after creating an organization. Refreshing resolved it and
showed the expected "Create a new project" form.
It looks like `useParams()` can return `slug` as `undefined` on the
first render during client-side navigation (there is an existing
comment in `[slug].tsx` acknowledging this). When that happens:
- `useSelectedOrganizationQuery` cannot find the org, so `currentOrg`
is `undefined`, and `isInvalidSlug` fires, showing `OrgNotFound`.
- `useAsyncCheckPermissions` also cannot resolve without an org slug,
so `can` (`isAdmin`) defaults to `false` while loading, which could
show `NoPermission` instead if `OrgNotFound` doesn't render first.
This change:
- Adds `!!slug` to the `isInvalidSlug` check, so we don't declare
the org invalid before we have a slug to look up.
- Uses `isLoading` from `useAsyncCheckPermissions` to avoid showing
`NoPermission` while permissions are still resolving.
Why?
This appears to be a bug in the new-user onboarding wizard. If it
gets encountered often, it could hurt conversion -- new users would
see a dead-end error page ("Organization not found" or "You need
additional permissions") at the moment they are trying to create
their first project.